-
addChild multiple mcs
Previously the below worked for AS2
Code:
for(var i=0; i< rankArray.length; i++) {
var item:Object = this.itemMain.attachMovie("item", "item"+i, i);
item.alpha = 60;
item.ranked = false;
item.indexValue = (randomArray[i]+1)*2;
Simply adding addChild comes back with 2 errors:
Scene 1, Layer 'as', Frame 1, Line 47 1067: Implicit coercion of a value of type String to an unrelated type flash.displayisplayObject.
and
Scene 1, Layer 'as', Frame 1, Line 47 1137: Incorrect number of arguments. Expected no more than 1.
How do I get this working with the addChild function?
Thanks
Eddie
-
AKA [ Paul Bainbridge]
where is your code that show you using addChild()?
-
Thats the problem, I am unable to successfully use addchild with this with my lack of AS3 knowledge, so when I do:
Code:
var item:Object = this.itemMain.addChild("item", "item"+i, i);
I get the errors. Do I need to re structure the way I call my movie clips to get this to work?
Thanks
Eddie
-
AKA [ Paul Bainbridge]
You should check the flash doc's about how to use addChild()
-
I have used addchild successfully many times calling 1movie.clip but not in a loop as shown in code, I couldn't find help in a book which or through Google which is why I came on here to learn how to do this
Eddie
-
You have not had success using addChild while passing it two Strings and a number. addChild takes a DisplayObject.
Read the docs
http://help.adobe.com/en_US/FlashPla...addChild%28%29
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|