Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > General > Best Practices

Reply
 
Thread Tools Rate Thread Display Modes
Old 06-25-2007, 09:10 PM   #1
Detroit_Andy
Registered User
 
Join Date: Jun 2007
Posts: 2
Default Referencing Programmatically Attached movie Clips

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?
Detroit_Andy is offline   Reply With Quote
Old 06-25-2007, 09:35 PM   #2
Detroit_Andy
Registered User
 
Join Date: Jun 2007
Posts: 2
Default

It looks like the Advanced Pathing tutorial directly addresses this question...
Detroit_Andy is offline   Reply With Quote
Old 06-26-2007, 04:13 PM   #3
hangalot
lala
 
hangalot's Avatar
 
Join Date: Feb 2002
Location: on the road
Posts: 2,859
Default

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
__________________
oi poloi
http://www.memorphic.com/news/
hangalot is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT. The time now is 03:44 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.