Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

DuplicateMovie and Buttons...

Posted on 2006-03-24
4
Medium Priority
?
150 Views
Last Modified: 2010-08-05
Hey there guys. I am running a duplicate movie loop that is retrieving its information from an array that loaded an xml. The movies are duplicating fine, however, I am assigning each movie's button to get a certain url with onRelease. The problem is that the buttons are all loadaing the same url for some reason. Is this because they are all pointing to the same function?

for (i=0; i<shows.length; i++) {
            duplicateMovieClip(slot, "slot"+i, i);
            slot = eval("slot"+i);
            slot._y += x;
            
            //-------------------------------------
            //trace(slot);
            //---------------------------------------------
            slot.photoImage = shows[i].photoImage;
            slot.showTitle = shows[i].showTitle;
            slot.desc = shows[i].desc;
            slot.link = shows[i].link;

            slot.button.onRelease =  function()  { getUrl(slot.link); }            
            
            loadMovie(slot.photoImage, slot.cargathumb);                        
}
0
Comment
Question by:alrav79
3 Comments
 

Author Comment

by:alrav79
ID: 16282425
Nevermind guys. I finally got it. I just assigned the button its own variable, realizing i couldn't pass one into a dynamic function.
function printer() {
      slot._y = -x;

      for (i=0; i<shows.length; i++) {
            duplicateMovieClip(slot, "slot"+i, i);
            slot = eval("slot"+i);
            slot._y += x;
            
            //-------------------------------------
            //trace(slot);
            //---------------------------------------------
            slot.photoImage = shows[i].photoImage;
            slot.showTitle = shows[i].showTitle;
            slot.desc = shows[i].desc;
            slot.link = shows[i].link;
            
            slot.button.btnLink = slot.link;
            slot.button.onRelease = function() { trace(this.btnLink); }             
                                    
            loadMovie(slot.photoImage, slot.cargathumb);                        
      }
}
0
 
LVL 34

Expert Comment

by:Aneesh Chopra
ID: 16282464
here is the fixed CODE:
---------
for (i=0; i<shows.length; i++)
{
      duplicateMovieClip(slot, "slot"+i, i);
      slot = eval("slot"+i);
      slot._y += x;
      //-------------------------------------
      //trace(slot);
      //---------------------------------------------
      slot.photoImage = shows[i].photoImage;
      slot.showTitle = shows[i].showTitle;
      slot.desc = shows[i].desc;
      slot.link = shows[i].link;
      slot.button.onRelease = function()
      {
            getURL(this._parent.link);
      };
      loadMovie(slot.photoImage, slot.cargathumb);
}

---------

Rgds
Aneesh
0
 

Accepted Solution

by:
GranMod earned 0 total points
ID: 16518485
PAQed with points refunded (125)

GranMod
Community Support Moderator
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses
Course of the Month15 days, 5 hours left to enroll

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question