duplicatemovieclip :: Does the object have special scope?

  • Willy
  • Graduate
  • Graduate
  • Willy
  • Posts: 199

Post 3+ Months Ago

I'm not sure i fully understand what is going on with my duplicated movie clips....

I have a movieclip picHolder.

I load thumbnail url's into copys of picholder in a post back from a php script... something like

c.onLoad()=function{

duplicateMovieClip("picholder",pic+i,i);
this["pic"+i].loadMovie(thumb_url)
////I want to set a path to the full size image as a variable in each pici instance
I've tried lots of stuff ex. this["pic"+i].path=big_url;
}

print pic1.big_url ----> NULL OUTPUT!!!
Above is pseudo code, I don't know how to associate / load variables of duplicated movies. I tried attatching a var big_url ="lalla"; to my picHolder main video.

I made a little button handler to make sure that its not a load time issue.... i have button that runs :
function test{
pic1.loadmovie("new url");
textbox.text=pic1.big_url;
}

The picture changes but i get NO OUTPUT in my textbox

Am i missing something about the way duplicate works?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Posts: 1402
  • Loc: Philadelphia, PA

Post 3+ Months Ago

Well in your psuedo code it could most likely be that you created the variable called "path" which takes the value of a variable called big_url, but all throughout the rest of your code, you reference the path variable as big_url... which doesn't exist because your variable is called "path".

As for your problem, I would recommend using an array for something like this. For example...

Code: [ Select ]
big_urls = [
"bigImage1.jpg",
"bigImage2.jpg",
"bigImage3.jpg",
"bigImage4.jpg"
];
for (var i = 0; i<4; i++){
  mc = picHolder.duplicateMovieClip("pic"+i, i);
  mc.fullURL = big_urls[i];
  mc.onRelease = function(){
    getURL(this.fullURL, "_blank");
  }
}
  1. big_urls = [
  2. "bigImage1.jpg",
  3. "bigImage2.jpg",
  4. "bigImage3.jpg",
  5. "bigImage4.jpg"
  6. ];
  7. for (var i = 0; i<4; i++){
  8.   mc = picHolder.duplicateMovieClip("pic"+i, i);
  9.   mc.fullURL = big_urls[i];
  10.   mc.onRelease = function(){
  11.     getURL(this.fullURL, "_blank");
  12.   }
  13. }
  • Willy
  • Graduate
  • Graduate
  • Willy
  • Posts: 199

Post 3+ Months Ago

Thats what i get for using pseudocode i guess...

Here is my actual code... Still not working

Code: [ Select ]
pic_side=88;
function showLoad(){
 xx=0;
 yy=0;
 for(i=0;i<c.n;i++){
    url="http://www.cashportals.net"+c["img_path"+i]+"t_"+c["name"+i];
    big_url="http://www.cashportals.net"+c["img_path"+i]+c["name"+i];

    if( i>0 && i % 5==0){
        xx=0;
        yy++;
    }
    _root.loadClip(i,xx,yy,url,big_url);
    xx++;        
 }
    
}

//Drop in the thumbs.
function loadClip(i,xx,yy,url,big_url){
    
    duplicateMovieClip("picHolder","pic"+i,i);
    setProperty("pic"+i, _x, (pic_side + 5)*xx);
    setProperty("pic"+i, _y, (pic_side + 5)*yy);
    this["pic"+i].loadMovie(url);
    this["pic"+i].path=big_url;
    statusBox.content.text=pic2.path;
    trace(this["pic"+i]);
    
}

function test(){
statusBox.content.text=pic2.path;
pic2.loadMovie("http://www.cashportals.net/justin/test.jpg");
}

picHolder.path="PICHOLD PATH";
picHolder._visible=false;
var c = new LoadVars();
c.load("http://www.cashportals.net/justin/dbreturn.php","_self","POST");
c.onLoad = showLoad;
picHolder.var2="LALALA";
texty.htmlText="<a href='asfunction:test'>Click to run</a>";
  1. pic_side=88;
  2. function showLoad(){
  3.  xx=0;
  4.  yy=0;
  5.  for(i=0;i<c.n;i++){
  6.     url="http://www.cashportals.net"+c["img_path"+i]+"t_"+c["name"+i];
  7.     big_url="http://www.cashportals.net"+c["img_path"+i]+c["name"+i];
  8.     if( i>0 && i % 5==0){
  9.         xx=0;
  10.         yy++;
  11.     }
  12.     _root.loadClip(i,xx,yy,url,big_url);
  13.     xx++;        
  14.  }
  15.     
  16. }
  17. //Drop in the thumbs.
  18. function loadClip(i,xx,yy,url,big_url){
  19.     
  20.     duplicateMovieClip("picHolder","pic"+i,i);
  21.     setProperty("pic"+i, _x, (pic_side + 5)*xx);
  22.     setProperty("pic"+i, _y, (pic_side + 5)*yy);
  23.     this["pic"+i].loadMovie(url);
  24.     this["pic"+i].path=big_url;
  25.     statusBox.content.text=pic2.path;
  26.     trace(this["pic"+i]);
  27.     
  28. }
  29. function test(){
  30. statusBox.content.text=pic2.path;
  31. pic2.loadMovie("http://www.cashportals.net/justin/test.jpg");
  32. }
  33. picHolder.path="PICHOLD PATH";
  34. picHolder._visible=false;
  35. var c = new LoadVars();
  36. c.load("http://www.cashportals.net/justin/dbreturn.php","_self","POST");
  37. c.onLoad = showLoad;
  38. picHolder.var2="LALALA";
  39. texty.htmlText="<a href='asfunction:test'>Click to run</a>";


Points to note, loadPic both sets the url and path of each pic variable...
When TEST is run, the url changes but the path comes up as null....

html is here:
http://www.cashportals.net/justin/thumbs.html

flash is here:
http://www.cashportals.net/justin/thumbs.fla

I'm baffuled.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 13 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.