Link to home
Start Free TrialLog in
Avatar of vanpevi
vanpevi

asked on

Flash Problem with the refresh of the Loader linked to the contentpath

Hello,
I put a button & a loader "containeur" on my timeline.

I tried with the autoload = true:

on (release)
      {
        _global.current = _global.current + 1;
      containeur.contentPath=""; // to clear
        containeur.contentPath=thisRoot["c"+_global.current];
      }

I tried with the autoload = false:

on (release)
      {
        _global.current = _global.current + 1;
      containeur.contentPath=""; // to clear
      containeur.load(thisRoot["c"+_global.current]);
      }

It works only for the first press... then the _global.current increase well but the loader becomes empty...In other words, the movie doesn't appear after the second (and third,...) release of the button.

As you guess, the thisRoot["c"+i] contains url.

Any idea? Sort of unload needed?

Thanks for your attention,

Vincent
Avatar of vanpevi
vanpevi

ASKER

I hope there is better solution than including the loader in a movieclip and then remove the movie clip and create a new one and remove the movieclip and...
Here it goes an example. It is working ok. Autoload set to true, just changing the contentPath. Can you send me your code so I can take a look at that for you?

Change the extension to .zip.
loader-button.zip.pdf
Avatar of vanpevi

ASKER

julianopolito, thanks for your answer but after the unzip, I try to open the fla file and an alert is displayed with: "Unexpected file format"
For info, I'm on Flash MX 2004...
Any ideas?
hmmmm, I saved as flash 8. I'll post the code here, as I can't save in mx 2004 (I'm using flash cs3):

- Create a new .fls document.
- Put in stage 2 components: a button and a loader
-Name the Button instance "but" (no quotes) and name the loader "mylo" (no quotes)
-In first frame of the main timeline paste the code below:
-run the application - it is working perfectly here
var i = 0;
var a = ["img/image1.jpg","img/image2.jpg","img/image3.jpg"];
var but:mx.controls.Button;
var mylo:mx.controls.Loader;
list = {};
list.click = function(){
	mylo.contentPath = a[i++];
}
but.addEventListener("click",list);

Open in new window

UPDATE TO POST ABOVE: not a .FLS but a .FLA (mistyped)
Avatar of vanpevi

ASKER

Dear julianopolito,
Your code works fine but when I replace your images "links" with the youtube links, it doesn't work anymore...only for the first one...any ideas?

please see here under:

var i = 0;
var a = ["http://www.youtube.com/v/5KOJ3iVPgyw","http://www.youtube.com/v/w8ltBJcIToE","http://www.youtube.com/v/BE6tYn8NEGQ"];
var but:mx.controls.Button;
var mylo:mx.controls.Loader;
list = {};
list.click = function(){
	mylo.contentPath = a[i++];
}
but.addEventListener("click",list);

Open in new window

Avatar of Peter Hart
you can' t use utube links in place of images - have you tried your own flash movies as links?
Avatar of vanpevi

ASKER

It is not really "youtube" links, it is the swf files provided by the api of youtube.

But I'll try with my own flash movies asap...
exactly you are not going to be able to call youtube movies directly. Also this is not the way you load video files through flash. To get youtubes movies through flash you need youtube actionscript api here http://code.google.com/p/as3youtubelib/ and ths code will probably not work without lot of modfication
Avatar of vanpevi

ASKER

Sorry chilternPC, but it doesn't work neither with my own swf files...just the first is displayed...
Help !!
Avatar of vanpevi

ASKER

julianopolito, I already managed the problem "youtube api" with a php page...and my flash application call this page and fill in an array...it works fine.
The code wrote above (02.02.2008 at 09:14PM ) works perfectly for the first movie...but not for the 2 next ones..strange isn't ?
Please explain what exactly is happening, if possible send sample code, or file. I can't find the reference code you said (02.02.2008 at 09:14PM ), is it correct?
 thks
Avatar of vanpevi

ASKER

The mentioned code is 7 messages upper in this "topic"...
Here is my simplified flash file:
http://www.swfup.com/uploads/swf-121517.swf
Click on the button, the first youtube movie will appear.
Click one more time, the second movie doesn't appear. Just an empty screen...
Click one more time, nothing appear...
You'll find the fla file here: http://www.partage-facile.com/117467-EE.fla.html

I tried the proposition of chilternPC it didn't work...I tried today to show you and it worked...but only with my swf files...

http://www.swfup.com/uploads/swf-121524.swf ( http://www3.partage-facile.com/1015581-EE.fla.html )

Help please!

PS:please, don't tell me it's not possible...it works fine with the first youtube, then it must be possible...


Avatar of vanpevi

ASKER

Moreover I switch the first and the second movie in my array definition and I have the same problem...
http://www.swfup.com/uploads/swf-121528.swf 
It prove that the problem is (probably) not with the youtube link...
Avatar of vanpevi

ASKER

Youtube + my swf1 + my swf2 works fine...
Youtube + my sw1f + Youtube doesn't work...
my swf1 + my swf2 + Youtube works fine...

it seems that only one youtube is allowed..so strange...


I'll take a look at your file and youtube docs and let you know what is happening
Avatar of vanpevi

ASKER

For info I tried the following code but it gives the same result than the previous tests. It means that just the first movie is displayed..and I tried the same code with 3 pictures in place of the the three youtube swf files..
Help !!

var a = ["http://www.youtube.com/v/5KOJ3iVPgyw.swf","http://www.youtube.com/v/BE6tYn8NEGQ.swf","http://www.youtube.com/v/mVfKVWKbfAI.swf"];
var but:mx.controls.Button;
list = {};
list.click = function(){
thisRoot.swapDepths(500000);
thisRoot.removeMovieClip();	
le_retour=_root.createEmptyMovieClip("thisRoot", _root.getNextHighestDepth());
thisRoot.swapDepths(but);
le_retour2=thisRoot.attachMovie( "Loader","my_loader" , thisRoot.getNextHighestDepth(), {_x: 0, _y: 0} );
thisRoot.my_loader.contentPath = a[i++];
}
but.addEventListener("click",list);

Open in new window

Avatar of vanpevi

ASKER

I forgot to say clearly that the solution just above works fine with the 3 pictures..but "indeed" not with youtube swf files...
hey all, i got a email request to have a look - that site to download the file - it's in a language i dont understand - is that button in the middle of the screen to download the file - i don't want to be downloading the something funny.
Avatar of vanpevi

ASKER

You'll find it (the fla file) here too if you prefer: http://www.megaupload.com/?d=PZUP0F23
Just write the confirmation code in the right top corner...
Thanks for your attention
ASKER CERTIFIED SOLUTION
Avatar of vanpevi
vanpevi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i didn't do anything so leave me be :-)
Avatar of vanpevi

ASKER

You thought about clicking on a french button, it was quite courageaous ;)

oups, I'm flooding...
hahaa *walks off with courageous look on face*
Avatar of vanpevi

ASKER

MHenry told me to accept my solution to close this topic...

I do it...

Thanks again for your attention.
Can Anyone help me
My loader is not working as it should work.
Please see
http://www.aplustutorsoft.com/popup_demo_econtent.htm
but if Rewind movie I can see loader.