Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
ADOBE FLASH: Adobe Flash ForumAdobe Flash TutorialsAdobe Flash Video TutorialsWeb Streaming ForumAdobe Flash

Loading external SWF files on button click

Cow Forums : Adobe Flash
Loading external SWF files on button click
by Kevin Ray on Jul 28, 2008 at 12:41:02 am

I am kind of new to AS and I want to load and external SWF file when I click a button and give a progress of the download.

I followed a tutorial in order to get this done.

Everything works great except it's loading the movie immediatly instead of when you click the button.

As its loading I can click the button and it starts reloading. So I believe it is working.

I don't want it start loading until you click the button.

Can someone tell me how to rearrange the code in order to do that.

Here is the code:
____________________________________________________________________

var mcl:MovieClipLoader = new MovieClipLoader();

var mclL:Object = new Object();

mclL.onLoadProgress = function(target,loaded,total) {
loader.percent.text = Math.round((loaded/total) * 100) + "%";
}

mclL.onLoadInit = function() {
loader._visible = false;
loader.percent.text = "";
}

mcl.addListener(mclL);

mcl.loadClip("benelli2.swf",holder);

b1.onRelease = function() {
loader._visible = true;
mcl.loadClip("benelli2.swf",holder);
}

Respond to this post   •   Return to posts index

Re: Loading external SWF files on button click
by Pieter Helsen on Jul 28, 2008 at 9:18:16 am

You won't learn much if you just take the code from the tutorial without actually understanding what it does... ;)

// Loads the clip
mcl.loadClip("benelli2.swf",holder);

// Button behaviour
b1.onRelease = function() {
loader._visible = true;
// Loads the clip again.
mcl.loadClip("benelli2.swf",holder);
}

Which of the two should be removed...?

Kind regards,
Pieter

General notice: from now on, I would like to ask everyone to put [AS2] or [AS3] (corresponding to the version of actionscript you are using on your project) in front of their post titles when the question is actionscript related! Please help us help you faster. Thank you.

Respond to this post   •   Return to posts index

<< PREVIOUS THREAD   •   VIEW ALL THREADS   •   PRINT   •   NEXT THREAD >>


FORUMSTUTORIALSMAGAZINEDVDsBOOKSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]