Actionscript 3.0 :: Load And Unload Swf's From Buttons Using Class Loader?
Feb 13, 2009
I am trying to load external swf's from buttons. I managed to load an external swf from a button, but as a result I can't work out how to get it to unload when other buttons are clicked. Currently In the flash file I have only 2 buttons 'dutrain_b' and 'portfolio_b'. I would like to add many more when the code is working.
I have a list of buttons each one bring to stage an image. The problem is I want the button to both load image and unload the image that is now on the stage from previous press on other button.
ActionScript Code: var loader:Loader; c1_btn.addEventListener(MouseEvent.CLICK, c1); function c1(event:MouseEvent):void{ var req:URLRequest = new URLRequest("1950s/julia1.jpg"); if(loader != null){ [Code] .....
This is an example of 2 buttons from my list. This code is for unload the other image but it only works ones. it's not working on the other buttons. So what the problem in this code? if(loader != null){ loader.unload(); Object(root).menu_mc.menuIn_mc.diary_mc.diaryW_mc. pic_mc.removeChild(loader); }
I have a flash rotating banner script that I purchased, and wish to incorporate into my homepage. Instead of creating a page with HTML and adding the banner code as a separate object on the page, I wish to load it as an external swf into a movieclip on my stage. This is what the banner looks like:
[URL]
I have a page that I'm redesigning, it's located at:
[URL]
I have a movieclip named load_banner. Inside the movieclip in its own frame, I put in the following code:
I'm trying to load an image in a movieclip using using the following:
Load_image_btn.addEventListener(MouseEvent.CLICK,Load_image); function Load_image(event:MouseEvent):void{ var my_loader:Loader = new Loader(); my_loader.load(new URLRequest("C:UsersAmandaDesktoppicture1")); addChild(my_loader);}
I just want to ask if is it possible to load a movieclip from the library using the Loader class together with the URLRequest and then use gotoAndPlay method?
I want to load an image from altavsita into my swf with loader class.Then I get this error message.From my flashdevelop flash player everything works fine.But from all others I get:[code]
I am working on a school project that requires me to load external .swf or .jpg files. I currently have all of the buttons working and are loading an external .swf file on to the screen. The problem I am having is that when I go from one button to the next the loaded .swf stays on the screen and the next .swf gets loaded on top of it. I know that I need to unload the file but I am not sure where to put the code for the unload or what code exactly to use. I would like when the button is pressed to unload the previous loaded .swf and load the new .swf without having a separate button to unload.
I'm trying to unload an external SWF on _root to load a new one instead. I've tried (almost) everything but can't figure it out... I get this error : "Error #1010: A term is undefined and has no properties."
In AS3 i am using the Loader class to load in multiple external SWFs (AVM1), each of which has a short animation which automatically plays when the swf is I obviously cannot control the timeline of these (i can't use local connection etc) but would like to load in the *.swf files, so they're in memory then add them to the stage when requested. the problem is that if i load them enmass. then use addChild when they are called, they have already played through and animated pre the addChild command.
(I cannot edit the swfs at all, and would rather not load them on demand at runtime)
I try to load a file over the local network with Loader Class but I get the error "URL Not Found". I use a path like this "file://///myPCnetID/pubilcFolder/pictures/mypic.jpg" which refers to a folder on the same PC I compile and run the Air flash file.
When I copy the adress into the browser the jpg-file ist displayed corretly.
I'm very very new on ActionScript 3.0 for mobile development. I'm using loader class to load images. I'm loading ten images with different sizes. I'm trying to load them with a common size (300x300) doing this:
I'm building an Adobe Air app that needs to load external images from different webservers. I have my basic loader function set up, but I encountered one server that wouldn't let me load it's images. it gave me the following error[url]...
After that I got in contact with the server's manager and he told me he had been working on some basisc hotlink protection for his images. He also told me that I could subvert this by supplying[url]... as the referrer when building the request headers.
First of all I found no trace of hotlink protection with online testapplications for hotlink protection. Secondly I have no idea how to set up what he told me with a simple Loader class function.[code]...
I Have 3 Movies:MAIN.SWF, contains loading movie actions for Nav.swf and Home.swf.NAV.SWF, contains navagation menu loaded on Level 2 in Main HOME.SWF, contains slideshow for home page loaded on Level 1 in Main In NAV.SWF, there is a MOVIE CLIP "graphmc", which contains a BUTTON "graphicbtn", When this button is clicked, I'd like the HOME.SWF (which is loaded into Main.swf on Level 1) to fade out and unload, and load and fade in Graphics.SWF in place of it.
I can't seem to be able to figure out how to unload a JPG image once I've loaded it so I can load a second JPG in it's place. Here's my code so far (document class, picHolder_mc exists already on the timeline). All that happens is the second JPG being called loads on top of the first.
How can I unload a movie from with in the UI Loader. I have loaded a movie into my UI Loader and there is a go back button And I simply want to unload that movie and return to normal.
I'm coding an xml gallery with thumbnails. Ive set a container for the thumbs and for the main image. when user clicks on a thumb it loads the larger image. Preloaders are done all is well however when the user clicks on a nother thumb it just loads in the image over the last one. How can I cause it to delete the currently displayed image and then load the new one.
would :- removeChild work or do I need to use .unload on the loader?
I am having some issues with my loader. What I have is one loader object that will load 5 different SWF loading xml galleries.It works fine the first time it loads, until I unload it to reload another gallery... then it will display its loading but nothing shows?
Code: var gallery:String=new String ; gallery="web"; var portIDReq:URLRequest=new URLRequest("viewer"+this.gallery+".swf"); var portIDLoader:Loader = new Loader(); portIDLoader.x=0; portIDLoader.y=0; [Code] .....
I have a URLloader that load an xml file, what i need is to be able to clear whats in the loader once the data of my xml has been loaded, is it possible to use unload in the on complete function? for example[code]...
I am building a portfolio gallery, with one loader who loads 5 different .swf which load XML files.Everything work, but once I unloaded it to reload it, it says that its loaded but I dont see anything anymore.I probably tried a 1000 versions, but here is my latest code:[code]
I have used the loader class to play an external .swf file. When it is finished I need to stop it and continue to the next frame in the timeline of the original movie. I can load it and unload it, but how to I unload it after it has played and continue to frame 2 of the timeline?
var myLoader:Loader = new Loader();myLoader.x = 150;myLoader.y = 75; myLoader.load(new URLRequest("movie.swf"));addChild(myLoader); myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,onComplete) ; function onComplete(e:Event):void{ myLoader.unload(); this.gotoAndPlay(2);}
With this code, it skips the loaded movie and goes straight to frame 2.
I have load external swf file with loader. The external swf file have animation with embeded mp3 file . when i click the btn unload the external swf file .external swf file is unload ok. But Problam is after few seconds sound is hearing. I think animation still running in backend when reach the first frame sound is hearing.
var ldr:Loader=new Loader()ldr.load(new URLRequest("test.swf")) addChild(ldr) btn.addEventListener(MouseEvent.CLICK,unloadmovie) function unloadmovie(e:MouseEvent){ ldr.unload() SoundMixer.stopAll() }
My code is try { if (MovieClip(this.parent)!=null) { if (MovieClip(this.parent).imagename!=null) { var t=MovieClip(this.parent).imagename; var url:URLRequest=new URLRequest(t); [Code] ..... My loader unload event not calling?
I want to unload my loader when i click the unload button, and to check if it unloaded successfully, i typed a trace command [trace("unloaded")] in the eventListener "EVENT.UNLOAD", but when i click the unload button, it doesn't unload.[code]any help on how to make unload work?