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
LVL 1
vanpeviAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vanpeviAuthor Commented:
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...
0
julianopolitoCommented:
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
0
vanpeviAuthor Commented:
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?
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

julianopolitoCommented:
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

0
julianopolitoCommented:
UPDATE TO POST ABOVE: not a .FLS but a .FLA (mistyped)
0
vanpeviAuthor Commented:
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

0
Peter HartCommented:
you can' t use utube links in place of images - have you tried your own flash movies as links?
0
vanpeviAuthor Commented:
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...
0
julianopolitoCommented:
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
0
vanpeviAuthor Commented:
Sorry chilternPC, but it doesn't work neither with my own swf files...just the first is displayed...
Help !!
0
vanpeviAuthor Commented:
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 ?
0
julianopolitoCommented:
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
0
vanpeviAuthor Commented:
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...


0
vanpeviAuthor Commented:
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...
0
vanpeviAuthor Commented:
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...


0
julianopolitoCommented:
I'll take a look at your file and youtube docs and let you know what is happening
0
vanpeviAuthor Commented:
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

0
vanpeviAuthor Commented:
I forgot to say clearly that the solution just above works fine with the 3 pictures..but "indeed" not with youtube swf files...
0
vanpeviAuthor Commented:
0
blue-genieCommented:
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.
0
vanpeviAuthor Commented:
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
0
vanpeviAuthor Commented:
Steph from the Youtube Api Guide Team answered me on the youtube dev forum...
It's a current bug of the youtube api,unknown before I came,but Steph has a "temporary" solution for me:
"As a workaround, create a new movieclip each time you loads a new
player swf. As long as the mc has a new name it should work. "
It's almost what I did, see the code hereunder...and...it works perfectly !!
Steph makes my day!

Unfortunatly I can't transfer my 500 points to Steph ;o)  ...

Thanks a lot to julianopolito & chilternPC & blue-genie for their attention...Should I split the points in three or keep it?

Moderator's team, this topic can be closed but I think should not be deleted, that could help Youtube "Api"-er
var a = ["http://www.youtube.com/v/5KOJ3iVPgyw.swf","http://www.youtube.com/v/BE6tYn8NEGQ.swf","http://www.youtube.com/v/mVfKVWKbfAI.swf"];
var i=0;
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"+i , thisRoot.getNextHighestDepth(), {_x: 0, _y: 0} );
thisRoot["my_loader"+i].contentPath = a[i++];
}
but.addEventListener("click",list);

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
blue-genieCommented:
i didn't do anything so leave me be :-)
0
vanpeviAuthor Commented:
You thought about clicking on a french button, it was quite courageaous ;)

oups, I'm flooding...
0
blue-genieCommented:
hahaa *walks off with courageous look on face*
0
vanpeviAuthor Commented:
MHenry told me to accept my solution to close this topic...

I do it...

Thanks again for your attention.
0
s_andeepCommented:
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.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.