2 Replies - 636 Views - Last Post: 30 June 2011 - 06:44 AM

#1 Braber01   User is offline

  • D.I.C Regular

Reputation: 5
  • View blog
  • Posts: 325
  • Joined: 29-November 08

Array of Type MovieClip

Posted 28 June 2011 - 01:26 PM

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?
Is This A Good Question/Topic? 0
  • +

Replies To: Array of Type MovieClip

#2 chinchang   User is offline

  • Indie Game Developer
  • member icon

Reputation: 192
  • View blog
  • Posts: 727
  • Joined: 22-December 08

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 :

var arr:Array = new Array();

for (var i:int=0; i<6; i++){
 var new_mc = new MovieClip();

Now whenever you need to access them, you can simply reference them from the array:
var _mc:MovieClip = arr[i] as MovieClip;

Was This Post Helpful? 0
  • +
  • -

#3 brandon_v   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 62
  • Joined: 29-May 08

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:
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

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1