| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Jun 2007
Posts: 2
|
Hello, I am teaching myself Flash in my spare time. I think this question is similiar to the other one posted in this forum by Jesse.
I want to programmatically create a set of menu buttons from several arrays with variable numbers of elements. So I wrote some script in a conditional loop that attaches a movie clip to the root timeline like this: nameString = "Button_"+String(count); _root.attachMovie("Button", nameString, 1); I also wrote it like this: _root.attachMovie("Button", "Button_"+String(count), 1); Then I ran into trouble because I had no idea how to reference the instances I had created. I want to offset the instances I created so they are not on top of each other. I could probably come up with a kludgy way to solve this problem but I decided that I might be better off asking what the best way to solve this problem is on a project level scope. ok, so once I have created an instance programatically how do I programatically acces it and its properties? The name of the movice clip was generated programatically, but I don't think that I can programatically reference it in the same way it's name was created. "Button_"+String(count)._y = 50; Will not work, right? I need to pull the name of the clip somehow. But I don't see how. So, how do I tell the interpreter Button_0._y = 50; programatically? |
|
|
|
|
|
#2 |
|
Registered User
Join Date: Jun 2007
Posts: 2
|
It looks like the Advanced Pathing tutorial directly addresses this question...
|
|
|
|
|
|
|
|
|
#3 |
|
lala
Join Date: Feb 2002
Location: on the road
Posts: 2,859
|
never bothered looking at that tut, but attachmovie and createmovieclip both return refrences to the object you just added to the stage.
don't use _root also look into the movieclip method getNextHighestDepth |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Loading images in different frames.. | nchagial | ActionScript 2.0 | 22 | 12-21-2005 09:06 AM |
| Can't get my duplicate or attached movie clips to play | DudeCool | ActionScript 2.0 | 2 | 11-02-2005 08:58 PM |
| How can I load multiple movie clips and mp3 so that the swf file will work? | wlester | ActionScript 2.0 | 0 | 09-16-2005 10:01 AM |
| referencing a button in an attached movie clip | lrempel | Simple Stuff (Newbies) | 0 | 01-27-2005 06:30 PM |
| Duplicating Empty Movie Clips?! | gogojuice | Simple Stuff (Newbies) | 8 | 06-16-2004 09:24 AM |