A Flash Developer Resource Site

Results 1 to 20 of 53

Thread: if then statements confusion

Threaded View

  1. #1
    Senior Member
    Join Date
    Oct 2009
    Posts
    112

    if then statements confusion

    I am reading information from binary sockets.

    I have an array of movie clips, each with a different instance name:
    ex: MCarray:Array=new Array (mc1,mc2,mc3,mc4,mc5);
    I have already done all the coding for the arrays so theres no confusion there.

    I need a statement that says:
    Code:
    "if the incoming variable refers to mc1+2, then make mc1 go to frame 2"
    "if the incoming variable refers to mc2+2, then make mc2 go to frame 2"
    if the incoming variable referrs to mc3+2, then make mc3 go to frame 2"
    and so on....

    does that make sense? anyway the problem with that is that i just want ONE statement because I will eventually have over a hundered movie clips, and so I don't want to make a hundred if-then statements for each function.

    there must be a way to say
    Code:
    my.addEventListener(ProgressEvent.SOCKET_DATA, myfunction);
    function myfunction(e:ProgressEvent):void{
           if("incoming variable=one of the movie clips from the array"+"2"){
               MCarray.(make that movie clip which was named go to frame 2);
           }
    }
    any ideas? thanks
    Last edited by mattwatts15; 11-13-2009 at 04:45 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center