I'm trying my best to make a wheel of fortune game and I have the image of the the "unfilled" puzzle board and I want to convert each and every one of these "unused" letters to a movieclip or something so I can dymanicly load a letter in a certan place is it possible to make an array of a movie clip object so I can change the images when I need to?
Array of Type MovieClip
Page 1 of 12 Replies - 299 Views - Last Post: 30 June 2011 - 06:44 AM
Replies To: Array of Type MovieClip
#2
Re: Array of Type MovieClip
Posted 29 June 2011 - 05:20 AM
Yes you can make an array of Movieclip objects. You would do something like this :
Now whenever you need to access them, you can simply reference them from the array:
var arr:Array = new Array();
for (var i:int=0; i<6; i++){
var new_mc = new MovieClip();
addChild(new_mc);
arr.push(new_mc);
}
Now whenever you need to access them, you can simply reference them from the array:
var _mc:MovieClip = arr[i] as MovieClip;
#3
Re: Array of Type MovieClip
Posted 30 June 2011 - 06:44 AM
Yes, it's quite possible to create MovieClip arrays.
As per Flex SDK coding conventions, your code should like something like this:
But it may be worth your while to look into using vectors for arrays of single data types.
The interface for vectors is similar to arrays.
This way, you can avoid having to cast an array to movieclip, so it's more robust, and so I believe, more speed efficient.
As per Flex SDK coding conventions, your code should like something like this:
var a:Array /* of MovieClip*/ = [];
But it may be worth your while to look into using vectors for arrays of single data types.
var v:Vector.<MovieClip>; v = new Vector.<MovieClip>();
The interface for vectors is similar to arrays.
This way, you can avoid having to cast an array to movieclip, so it's more robust, and so I believe, more speed efficient.
This post has been edited by brandon_v: 30 June 2011 - 06:48 AM
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|