ActionScript 3 Full Browser Background Content
ActionScript 3 Full Browser Background Content.
This is the second third iteration of this class. I decided to put the NpFSObjectResize Class to use within this demo, using that class as the superclass for here. As a result, this new version of this file is much more capable, supporting stage alignment modes along with a simple method for loading in new background images or swfs. You could use that feature to create a simple full browser slideshow, but be warned that I have not used the same bitmapData memory management techniques as I have within the Full Browser Cross Fading demo. So, your memory useage could get higher using this class as a slideshow (as you will be waiting on the garbage collector to do its thing).
This class has been completely rewritten, as of version 2. The api has changed, and many new methods and properties are present. The classes event model has been shifted into its own class, and a new class now wraps each display object, which is the foundation for more work on transitions other than a straight alpha fade. This version is not compatible with any older versions!
The demo file contains an example of using this class with an XML iterator, with various methods for creating slideshows etc. Along with this example, is a very simple implementation, commented out in the actionscript layer of the .fla.
Class Features
- Stage Alignment Modes
- Load New Bg Method
- Specify Cross Fading Time
- Specify Min Stage Scale points
- Pass Through Mode, where scaling is disabled
- Specify Max scale of content
- Specify content only scales upwards
View Example
Here is an example. In this example, the first file (swf) is set to scale to only 70% of the stages size, and stay centered, the second file (bitmap) is set to scale to full browser dimensions. View example here: http://www.noponies.com/dev/as3_fullbrowser_bg/
Updates
04 August, 2008: Added in ability to load in swfs as content.
17 Oct, 2008: Method change, shift from using timer to crossfade to internal Adobe tween class.
06 Jan, 2009: Completely rewritten, new API, new classes, new event model.
08 July, 2009: Fixed the bug with short tween in times, and a small issue with garbage collection
13 July, 2009: Fixed a slight bug with the example files related to iterating in reverse over a collection
Source Files
Here is the relevant source file; Full Browser Content Files (3229)
I’ve been playing around with javascript libraries more and more recently, I converted this file into a lightweight jQuery plugin, which can be viewed here; http://www.noponies.com/dev/as3_fullbrowser_bg/resize.html. If there are no problems, I’ll release it. In many ways, the writing is kinda on the wall for Flash, javascript can do a lot of the presentation things I would normally do in Flash.
By downloading, you agree to the terms of use, outlined here: http://www.blog.noponies.com/terms-and-conditions
Dependencies
None.

August 1st, 2008 at 1:31 am
Wow!!
This is great!! That’s exactly what I’ve been waiting for…especially the alignment option.
If you use this class for a website and you change image when the visitor clicks on different sections of the site – then will there be problems with memory? What do you think?
All the best, Niklas
August 1st, 2008 at 1:43 pm
Niklas,
No, it should be fine. The old image would get garbage collected eventually.
You could also use the Full Browser Crossfading Class file to do the same thing.
August 1st, 2008 at 7:14 pm
Hey Dale, whats up?
Well, can I use a swf or only bitmap?
Thank you!
Nice class!
August 1st, 2008 at 8:23 pm
Hi Aloysio,
It uses bitmaps. You could use the NpFSObjectResize Class to resize whatever you wanted to fullbrowser dimensions.
All thats missing is the loading items element of it.
August 2nd, 2008 at 7:34 am
But with this Class I can’t get proportional scaling right?
Thank you so much!
August 2nd, 2008 at 6:28 pm
Aloysio,
You can scale it how you like, proportional, based off browser height, based off browser width, and in any of those modes, you can position it how you like..
August 4th, 2008 at 9:58 am
And I could load some flv videos there?
August 4th, 2008 at 11:44 am
Gaston,
Probably would work. They wont be smoothed, and the class gives you no control over their playback etc.
August 8th, 2008 at 3:35 pm
Hey Dale, now can I resize this on load my movie? I trying to addResizeTarget but when I compile my movie I need to resize the stage to get proportional. How do I get proportional when the movie start without need to resize the stage?
Thanks mate!
August 8th, 2008 at 4:09 pm
I’m asking you about it because i’m using this class in a slideshow component and i can’t resize this when i compile the movie.
August 8th, 2008 at 6:37 pm
Aloysio,
The addResizeTarget method should automatically resize your content.
You could try manually dispatching a Event.RESIZE event.
dispatchEvent(new Event(Event.RESIZE, true, false)
Thats just pseudo code, you would want to look in the docs at the RESIZE event to see how its dispatched.
August 9th, 2008 at 2:33 am
Hey Dale nice class I was looking for something of this nature. But everytime I publish in FireFox I have about a half of inch of stage showing. What am I doing wrong to cause the background pic to not fill up the entire browser window?
August 9th, 2008 at 6:00 am
I know the dispatchEvent and the Event.RESIZE, I try that but no success. What happening is when I try to dispatch the method addResizeTarget inside the dispatchEvent my component instance get visible off, but when I resize the stage they get visible true.
Thanks!
August 9th, 2008 at 6:06 am
I’ve create a movieclip different from the component and when I apply the method the movieclip get resize fine. But in the component slideshow I can get the same think. Do you know what is wrong?
August 9th, 2008 at 3:16 pm
Aloysio,
NO, not really. Not without seeing the files or something like that.
August 9th, 2008 at 6:14 pm
Ok Dale, sure, without files you can’t understand the issue. Well, I’m using this component, http://flashotaku.com/building-an-auto-slideshow-with-as3/, can I use your class to get a proportional resize to this component.
Thanks Dale!
August 9th, 2008 at 9:31 pm
Travis,
Check that your CSS settings are removing the browsers padding etc..
August 9th, 2008 at 9:34 pm
Aloysio,
Ok, looks like that component has a scale setting, have you turned that off etc.
Also, you could just use the NpFSObjectResize Class by itself to scale your content. Otherwise, it seems to be something specific that component is doing which is disabling the resize.
August 10th, 2008 at 9:34 am
Dale, then I can’t scale proportionals this component?
Thank you so much with these helps!
August 10th, 2008 at 5:22 pm
Aloysio,
This class simply extends the NpFSObjectResize Class. So all the features related to resizing your content are available to the NpFSObjectResize Class.
August 10th, 2008 at 5:48 pm
Yes! Right, but I don’t know how do I use this to resize with external swfs into the xml file.
August 11th, 2008 at 10:32 am
Hey thanks for the reply Dale, I have an easy question. How do I change the cross fading time? Thanks.
August 11th, 2008 at 12:12 pm
Travis,
classinstancename.bgFadeInTime = someTimeInSeconds
August 11th, 2008 at 12:14 pm
Aloysio,
I thought your component you were using handled all the XML loading etc?
If you just want to be able to to have your images loaded in via XML, using this class, let me know, and I can whip up a quick demo.
August 11th, 2008 at 1:21 pm
Yes, I want to have my SWFs loaded via XML and I will should resize it proportionals.
August 11th, 2008 at 4:36 pm
Dale, i’ve created another way to load my swfs into xml.
//Call function to show images into XML.
function showImage(current:Number):void {
loader.unload();
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
loader.load(new URLRequest(bgXML.swfs.swf[current]));
holder.addChild(loader);
holder.alpha = 1;
}
//Load Progress Function
function loadProgress(Event:ProgressEvent) {
var bl:Number = Event.bytesLoaded;
var bt:Number = Event.bytesTotal;
var percent:Number = bl * 100 / bt;
trace(percent);
}
//Load Complete Function
function loadComplete(event:Event) {
if (!timer.hasEventListener(TimerEvent.TIMER)) {
timer.addEventListener(TimerEvent.TIMER, nexPic);
timer.start();
}
}
function nexPic(te:TimerEvent):void {
if (currentPic < (total-1)) {
currentPic++;
showImage(currentPic);
} else {
currentPic = 0;
showImage(currentPic);
}
}
But when I apply an instance of NpFSObjectResize with my movieclip holder inside the parameters and call it inside a resizable function Event.RESIZE with dispatchEvent I can’t see automatically the holder resizable, I need to scale the window to see the movieclip with the method aplied! Very strange, are you know what is going wrong?
Thank you!
August 16th, 2008 at 11:22 am
Hey Dale, I fixed it. I just add a OnEnterFrame event with the method addResizeTarget inside and my backgrounds apear normally! =)
September 16th, 2008 at 9:02 am
Hi there,
I’m trying to use this class to load quite a big swf file, (1.2Mb ) but it’s not working at all, is there any size limitation in the class?.
I tried using the NpFSObjectResize() class, but the swf it is only showed when I resize the window and not as soon as it’s played (it’s like it is playing but it cannot be seen).
Any help would be kindly appreciated.
September 16th, 2008 at 12:00 pm
It should load it fine. So, no, no size limitations.
Its using a complete event to handle the loading of content. When loading in SWFS, the complete event will only fire when the loaded SWFS content is entirely available. So, there is a chance that the first frame could play, but the rest of the timeline has not completed downloading. Try changing the COMPLETE events to INIT events..
September 17th, 2008 at 8:24 pm
Awesome class. Is there any way to have the background static while the content is scrolled?
October 1st, 2008 at 8:35 am
Neat. I have the demo running and I can figure out how to put my own swf (a converted jpeg) in there so I’ve a scalable image in my browser background: brilliant.
The documentation here looks comprehensive but I can’t find a list of the “params”.. a list of those would be great, although perhaps I’ve worked out what they do.
thanks
October 1st, 2008 at 10:49 am
phil,
The ‘params’ are the getter/setter methods. The only traditional ‘param’ – something passed into the constructor function, or to one of the public methods is the URL for your content..
October 3rd, 2008 at 12:19 pm
when i resize the stage to Stage.with < Stage.heigth this Class Don’t work why???
October 3rd, 2008 at 6:50 pm
Camilo,
I have no idea what you are talking about.
October 8th, 2008 at 12:27 am
Hey…
Awesome! I apologies, but i was wondering if there is a way to have random images set up somehow? Any help on this would be awesome!
Thanx.
Shaun
October 8th, 2008 at 4:55 am
again i’m totally sorry, but say i want to have five images. how do i add more that the two? Sorry for the dumb question, but i’ve tried everything i can think of and just brain dead!
thx again! much appreciated!
October 8th, 2008 at 7:32 pm
Shaun,
You will need to create an array to store your image urls. Then, simply move through that array with each button click etc pass each new URL to the class.
October 8th, 2008 at 9:43 pm
Greetings and THANKS for the amazing components. I’ve just put this together using a couple of them: http://www.limitedwave.com/204/ . I have a question about the transition time. No matter what I change ::private var fadeInTime:int = 2; ::to it always has the same length fade. Can you verify this? I even bumped it up to 5 and 10 and saw no change. It would be perfect for me to be twice as fast…thanks a lot. Cheers!
October 8th, 2008 at 11:34 pm
Andy,
I’ll look into it.
October 14th, 2008 at 11:35 pm
Hello,
This blog is my treasure of the week! Thank you very much for this great component.
I’m a newbie to AS3.0 and have been a bit confused after playing the the code. Is there a way to remove the MouseEvent.CLICK function and modify it so that the movie will fade straight to the bitmap instead of having to have the user click?
I think this is may sound like a very basic question, but I will appreciate any help.
Thanks.
October 15th, 2008 at 8:11 am
Andrew,
Simply change where it loads the swf to the path to your image. Then remove all the references for clicking on the stage etc.
October 16th, 2008 at 12:23 am
Thanks for your reply Dale. I have removed all references of the MouseEvent. However, when I run the movie the bitmap does not show.
This is my code:
import noponies.display.NpFullBrowserBg;
var newBrowserBg:NpFullBrowserBg = new NpFullBrowserBg(“images/mymovie.swf”);
newBrowserBg.minStageScaleY = 1024;
newBrowserBg.minStageScaleX = 768;
newBrowserBg.useStageScaleMin = true;
addChildAt(newBrowserBg,0);
function loadNewBg(event:Object):void {
newBrowserBg.alignX = .5;
newBrowserBg.alignY = .5;
newBrowserBg.loadNewBg(“images/background1600.jpg”);
}
I also changed the event type to Object instead of MouseEvent.
Thanks for your help.
October 16th, 2008 at 3:14 pm
@Andrew:
var newBrowserBg:NpFullBrowserBg = new NpFullBrowserBg(?¢‚Ǩ¬ùimages/mymovie.swf?¢‚Ǩ¬ù);
should be:
var newBrowserBg:NpFullBrowserBg = new NpFullBrowserBg(?¢‚Ǩ¬ùimages/background1600.jpg?¢‚Ǩ¬ù);
Great class, by the way!
October 16th, 2008 at 4:38 pm
Sorry for the double post, I forgot to mention this.
I’m having the same issue Andy is having. No matter in what way I set the transition time (either editing it in the class file ?¢‚Ǩ‚Äúprivate var fadeInTime, or by passing it through ?¢‚Ǩ‚ÄúsomeClass.bgFadeIn), nothing seems be happening to the transition.
Any ideas?
October 17th, 2008 at 3:16 am
Any word on crossfade times? Thanks.
October 17th, 2008 at 5:34 am
Andy,
I’ve updated the class. Re download it. Watch out for some method name changes however.
The docs demonstrate the new method names etc.
Let me know if that crossfade issue is persisting. In my testing its gone.
October 18th, 2008 at 3:09 pm
It works perfectly now, thanks!
loadNewBg has been changed to loadBgContent.
October 18th, 2008 at 9:56 pm
Joris,
Glad its working for you.
October 26th, 2008 at 7:04 pm
Hey man,
Just a quick note of thanks – this class is extremely helpful and is a great time saver.
Cheers for making it available
November 18th, 2008 at 4:46 pm
Hi Dale,
Awesome post
I am trying to get an XML array of images to work for the back ground content (band website) but I am having trouble getting the bgcontentURL function to work.
Do I need to define in all the XML/loader variables/functions? or have they already been defined in the script and the current loader is sufficient?
I have found this function that deals with loading URL;
public function loadBgContent(bgcontentURL:String):void{
this.bgcontentURL = bgcontentURL;
loadBg()
}
If I define XML var’s then can I simply target the images in the string?
Cheers
Murray!
November 22nd, 2008 at 10:42 pm
Murray,
That function requires that you pass it a string. You need to keep your XML parsing etc seperate and when you are done parsing it, then you should pass in each image URL as you require it to the loadBgContent function. This class itself, does not handle any parsing of XML etc.
December 21st, 2008 at 5:32 pm
Thank you so much for the fix! I have not yet implemented, but shall do it today. Thanks again…you’re stuff ROCKS!
January 6th, 2009 at 4:14 pm
found one bug in your code:
TweenEvent.MOTION_FINISH not asignet to the tween
NpFullBrowserBg.as
Line: 364
YOU have:
addEventListener(TweenEvent.MOTION_FINISH, alphaTweenDone);
NEED to ADD
alphaTween.addEventListener(TweenEvent.MOTION_FINISH, alphaTweenDone);
January 6th, 2009 at 9:06 pm
Hey, Thanks for pointing that out. I’ve actually got an updated version of that class that I meant to upload that fixes that issue. I’ll have to get around to it.
January 7th, 2009 at 3:21 am
And, that updated version is now live.
January 8th, 2009 at 5:26 pm
Dale,
I had posted earlier this morning about a problem with scaling a 1440 x 900 background.
Your class breaks on the “full” setting. When I try displaying the 1440×900 image its cropping sections off (depending on the xPos and yPos). It only works when windowed and isn’t properly displaying a full browser image.
January 8th, 2009 at 7:34 pm
It will crop off parts of your image in full mode, as its a proportional scale. Which means that the smallest dimension of the image matches the smallest dimension of the browser. The largest dimension of the image is likely to be “cropped” or outside of the browsers window. Thats how proportional scaling works. The class does not have a “fit to window exactly” mode.
January 15th, 2009 at 12:25 am
Hey there Dale!… first off great work on all the ponies!!
I have a question relating to this script… I have built my own custom flash component in AS3 which essentially does the exact same thing as these classes.
I am running into cross browser compliance issues though??
It seems that in Firefox, Flash is unable to detect the stage.stageWidth and stage.stageHeight properties??
I have also noticed that when I add
stage.addEventListener(Event.RESIZE, resizeHandler);
this event handler is no longer fired when viewing the page in firefox??
I am wondering if you or anyone else has run into this type of issue before? and what the possible solutions are?
I have integrated a javascript callback into my script, which in the event Flash cannot read the stage width or height it will call a javascript function and be returned the correct stage width and height values. The only problem with this is that if my event handler which is listening for the stage resize doesn’t get fired, Flash doesn’t know when to communicate with the javascript function.
Again if you have any insights on this issue feel free to leave a reply or PM me!
Thanks again for all your hard work and great class files!
January 16th, 2009 at 4:57 am
I’ve never had any issues with Firefox like that, but I know of some other people who have had issues with it. Seems like a rather convoluted means to get around not being able to access the stage.stageWidth etc. Are you embedding it using SWF object etc?
January 18th, 2009 at 5:37 pm
Hi Dale,
I am using your sample file to practice with this class.. and I am trying to control the (modified) test.swf and have it gotoAndPlay(2); with a button click. How do I control that loaded swf? This is probably a total newbie question so thanks for any help!
matt
January 19th, 2009 at 9:33 pm
Try using the bgObject method, although you will have to cast it, something like MovieClip(bgContentInstance.bgObject).gotoAndPlay(2)
January 23rd, 2009 at 10:06 am
Hi there!
there’s something I’m missing, call me stupid, but whenever i open the as3_fullscreen_bg.fla and publish it, the following error pops-up:
Line 1: 1046: Type was not found or was not a compile-time constant: TextField.
January 23rd, 2009 at 3:55 pm
Hi Dale
I had a question about resizing of swf. I’ve created an example here: http://www.vph.co.uk/imran/no/sample/index.html
This is the same as the samples that you provided, but in test.swf i’ve put a copy of the text outside of the stage.
Is it possible to rezise the swf such that you resize the stage full screen and not all of the swf.
All help would be greatly appreciated. Thanks
January 25th, 2009 at 7:49 pm
got the same problem as Jorge
1046: Type was not found or was not a compile-time constant: TextField.
January 25th, 2009 at 7:55 pm
But – its just a line missing in the Main.as
import flash.text.TextField;
January 25th, 2009 at 9:54 pm
It shouldn’t be requiring that import, as the demo does not actually create an new TextField instances. But, simply add in the import. import flash.text.TextField;
January 25th, 2009 at 9:56 pm
You possibly dont have your publishing settings set to automatically declare stage instances.
January 28th, 2009 at 12:38 pm
What is the raster overlay for? Is it just for destroying the compression artefacts? Or any other reason? Is it better or worse for the performance?
Thank’s a lot! I like your site and your code!
Greetings from Hamburg, Germany
_Jerry
January 28th, 2009 at 10:50 pm
Hi Dale,
I’m fascinated by this code, it is exactly what I’m looking for but….
I may be missing something very obvious (I should also say that I am new to AS3) but are there any tutorials/guidelines that show how to implement this code? I have downloaded the files and tried to create the swf from the fla with amending anything, but it throws up alot of error messages. So I seem to be stuck at the first hurdle.
My goal is to have a slideshow in the background that I can stop and blur out once menu items are clicked. Is this going to be possible with this class.
Many thanks, Jon.
February 3rd, 2009 at 1:36 pm
Hello
I ran the sample code in CS4 and it worked perfectly fine. When I ran the same code in CS3, I had to import flash.text.TextField and in addition I was sometimes getting this error when loading a new background image:
Sorry, a Error has occurred when attempting to load gallery content [class Error]
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
Anyone else experienced this and know of any solutions? All help would be greatly appreciated. Thanks
(In addition we’ve used this fullscreen on some projects and CS4 seems to work fine all of the time, and CS3 projects seem to throw that error up quite randomly.)
February 5th, 2009 at 10:45 am
Hi you did a great job on this, very nice .
I have the same problem as Imran Neighed when i try to load a new bg img any ideas any one?
February 5th, 2009 at 9:11 pm
Thats an odd error, because its related to a try / catch block for making a URL Request for each new slide image. I cant seem to reproduce that error. Having tried publishing it to flash player 9 and 10. Its even more odd, as the load method of a loader object is not supposed to throw any argument errors.
It shouldn’t be producing it, the code is straight from the adobe as3 help…
The only think I can think of is that the loader instance has not instantiated, but it should, as its created in the class constructor.
February 5th, 2009 at 9:13 pm
How are you attempting to load the new image? What version of Flash, what web browser are you testing it in?
February 6th, 2009 at 10:28 pm
@Imran,
Ok, I’ve made a few subtle adjustments to the class. Try downloading the new version, and see how it goes.
I think the issue is caused by re parenting the loader objects content, which I do in this class, adding the loaders content to a new instance of the SlideItem class. It seems that the loader object is not able to handle having its content removed, when it makes a new load operation. To me, this seems like a bug in the Loader class. It should be able to handle having its content reparented, and check for the existence of this content when a new call to its load() method is made.
February 10th, 2009 at 4:34 pm
Hi Dale
Can you give some more info about using the NpSlideItem ?
I
February 10th, 2009 at 4:35 pm
Hi Dale;
Can you write more about using the NpSlideItem ?
February 16th, 2009 at 8:07 pm
@Burn,
What do you want to know?
February 16th, 2009 at 10:54 pm
How to use the NpSlideItem class. I want tome make a transition between backgrounds that uses Tweener and for example loads the new background, sets the brightness of old to -1, then fade in the new background (sets the brightness from -1 to 0. Is it possible with NpSlideItem?
February 17th, 2009 at 3:34 am
Hi,
Yeah it is possible, I built the slideItem so that it could be extended easily etc. Just change the tweens where it fades in via an alpha fade to a brightness transition. I’m about quarter way through writing a class to handle those more exotic type transitions, but I’ve run out of time at the moment to finish it.
February 17th, 2009 at 11:41 am
thx now it works perfectly in CS3
February 17th, 2009 at 11:32 pm
I’m doing some wxperiments with this. Btw the sample is in CS4 and it do not want to open in CS3 (i got original CS3 and ain’t got CS4)
February 17th, 2009 at 11:43 pm
Oh, I’ll downsave it, and re upload it later on today.
Done!
February 22nd, 2009 at 11:17 pm
Hi Dale,
I am struggling with how to access the content of my loaded SWF file. I cannot seem to manage this!
Can you please help?
Rgds.
R
February 23rd, 2009 at 12:51 am
@Rizz,
Ok, I just adjusted the NpFullBrowserBg.as NpSlideItem.as files. And tried it out with a swf, and getting it to jump to a new frame. Seems to be working OK now.
Redownload the classes, and you should be good to go.
There is a commented out example in the Main.as of how you need to cast the result of calling bgBackgroundInstance.bgObject getter.
I should really change that getter method name to something more descriptive.
February 24th, 2009 at 3:07 am
Hi Dale,
Hope your doin fine! Thanks for the quick response! Damn appreciated!
Your adjustment works excellent without having a documentclass in it. See if I trace the object with your sample. The output is “object MainTimeline” but in my own example I have a documentclass in the SWF I am loading. The output I am getting is “object nxtMain”.
What I need is to access the library items in the loaded SWF.
greets and thanks for your prompt reply!!
Rizz
February 24th, 2009 at 4:03 am
You will have to look at applicationDomain etc to access your loaded swfs library items.
February 24th, 2009 at 8:18 am
Thanks! will take a look into it straight away!
March 23rd, 2009 at 12:42 pm
I d like to ask, if i want to use like say 6 pictures or swfs. that will start allover again as soon as they end.. should i repeat the functions and not use the removeEventListener?
April 9th, 2009 at 4:18 am
This class seems great but the project I’m working on has a wrapper .swf loading the main.swf (which has the fullscreen background class). Im trying to avoid two preloaders so how do i tweak this class to pull an image from the library rather than an external image? I want to do this so the bkgrd image loads in all at once with the main.swf.
thanks again for the help.
April 14th, 2009 at 3:31 pm
So I’ve kept trying to rewrite the class to accept a display object linkage directly from the library rather than loading in an external jpg or swf, but still haven’t gotten it to work. Any suggestions?
May 14th, 2009 at 6:31 pm
Man, this class rocks!!!!!
THANKS a lot. I wish I had some money to donate.
People like you make us keep believing in an open, free, democratic and profitable Internet.
CONGRATULATIONS from Brazil.
June 10th, 2009 at 9:02 pm
Dale, every time when I call “removeChild(newBrowserBg);” I get a IO error: “Sorry, a Error has occurred when attempting to delete Slide [class Error]“.
I even tryed call removeChild using your “sample.fla” and got the same error.
Is there a workaround for this?
June 11th, 2009 at 8:44 pm
Ok, thats due to the tween not getting removed correctly. I’ve got a fixed version of it here, and will upload it during the weekend. I’ve just been working on a demo that implements an iterator design pattern and swfAddress.
June 12th, 2009 at 4:38 pm
Thanks Dale! I will be glad to test it and inform any bugs.
July 8th, 2009 at 9:37 pm
Uploaded an updated version of the class. Let me know if I’ve introduced any new bugs etc..
July 12th, 2009 at 8:47 pm
Dale,
I’m having trouble with the ‘previous’ method of the XMLIterator class. What i’m trying is to make a fullscreen gallery, with a next and prev button. Next is working but with the previous button i’m getting an IO error with ‘URL Not Found’.
Also when I trace which image is loaded, i’m getting the first one twice. So even if the second image is loaded, the url of the first image is traced. Dunno if it’s related to my problem.
Any suggestions?
July 14th, 2009 at 11:15 am
Hi,
I take it that the previous button works if the gallery is past the first image? The problem is that the reset method is not taking into account gallery looping, so I’ll have to adjust that.
July 14th, 2009 at 12:32 pm
Ok, so to fix that slight issue, there are two options.
1 / Add in a new interface, for a looping iterator, that that subsequent iterators can implement etc.
2 / Change the reset method of the existing class to take a parameter that determines if the reset should reset to 0, or to the end of the collection.
I took option 2 as the shortest and most flexible route. It seemed like overkill to add in a new interface, to deal with looping, when a slight massage of the reset method is all that is required to achieve the same effect.
As a result, you will have to update your code slightly when using the reset method in conjunction with any of the previous methods. The sample files contain the new classes, also, the documentation does not really reflect the new param for the reset method. I’m in at work, and don’t have asdoc running here.
July 16th, 2009 at 9:44 am
Thanks for the quick fix for the reset method.
But the problem is really in the previous method. It’s not working when the gallery is past the first image. I think something goes wrong with the index numbers.
Let’s say I have 5 images in a xml file. When I trace the _collection.length, I get 5. But when I try to return _collection[5] an TypeError #1009 comes up. If I return _collection[4] I get image #5.
And your new fla also gives a #1144 error.
Any suggestions on this one? Thanks in advance!
July 16th, 2009 at 9:56 am
Arrays are zero indexed, so if your array has 5 items, the last one is actually array[4].
Oh, looks like I included the wrong interface file. The previous methods are working totally fine here. The demo file runs in reverse. I’ve fixed that error in the .fla.
July 16th, 2009 at 10:30 am
Thanks! But I really have to bother you one more time, if you don’t mind
Prev and next are working perfecty now. But there is still something not right.
When I go from #1 to #2, and I want to go back from #2 to #1, I first go to #3 and then I go back to #2. So it goes one step in the same direction as you where going and only after that it goes the other direction.
Can you help me one more time
I’ll be out of your hair after this haha.
July 21st, 2009 at 10:55 am
@Dean,
I’ve updated the iterator classes again, to loop correctly etc. The docs are out of date, until I go home and regenerate them.
July 21st, 2009 at 11:23 am
Thank you soo much!!! Everything is working perfectly now!
July 21st, 2009 at 9:15 pm
@Dean,
No problem, my fault for not testing that iterator out correctly,
.
I’ve updated the docs etc.
August 10th, 2009 at 10:04 pm
Hello,
I am trying to experiment with this file but for some reason the sample preview file that you included isn’t working at all for me (all I get is a white background with nothing on it). When I open up the “as3_fullScreen_bg.fla” file I get the following error as well…
“1046: Type was not found or was not a compile-time constant: NpFsBrowserEvent.
August 19th, 2009 at 9:32 am
Hey Dale, Great work you are producing! Very inspiring!
I have a question with this file. If i want to put a text description somewhere on the screen for each picture that is displayed from the xml file, how would i accomplish this?
The pics are of course in an array, but i want to be able to display a title on the screen as well. Thanks very much if you have time to reply!
Greetings Morty
August 19th, 2009 at 2:42 pm
Hook into the slide transition finish event, and each time that event fires, update your text box with the correct text, based off the index of your images from your image array.