Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-12-2004, 09:20 PM   #1
ssipse
Registered User
 
Join Date: Feb 2003
Posts: 222
Default dynamically assign mc instance names?

is it possible to dynamically assign movieclip instance names?

for example, i wanna do like..

onClipEvent(){
this.instanceName = "blah"
}
ssipse is offline   Reply With Quote
Old 05-13-2004, 01:01 AM   #2
vosgien
member
 
Join Date: Dec 2001
Location: France
Posts: 923
Default

Hi,
You need to create the instances dynamically, first you need a text file that should look a bit like this
&myVars=instance1,instance2,instance3,instance,... .......and so on- you get the idea, save the file and call it myText.txt
You can create a movie clip dynamically, but for this exercise, create your clip on stage, double click it and in frame 1 put
PHP Code:
trace(this._name
delete it from the stage, open the library and give your clip a linkage identifier( right click - ckick on linkage), then try this code on frame 1 of the main timeline:
PHP Code:
myLVs = new LoadVars()
myLVs.load("myText.txt")
myLVs.onLoad = function(success)
{
if(
success)
{
clipWidth 20;/*this will place the ckips 2 pixels apart*/
myInstanceNames = new Array()
myInstanceNames this.myVars.split(",")
for(
0myInstanceNames.lengthi++)
{
attachMovie("clip",myInstanceNames[i], i,{_y:50,_x:50+clipWidth *i})
}
}
}

/*where "clip" is the linkage identifier*/ 
Hope that helps

Vosgien
vosgien is offline   Reply With Quote
Old 05-13-2004, 07:54 AM   #3
pom
Allez les Bleus!!!
 
pom's Avatar
 
Join Date: Oct 2002
Location: Paname
Posts: 2,493
Default

Keep it simple
Code:
this._name = "blah"
pom 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 Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:08 PM.

///
Follow actionscriptorg on Twitter

 


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