A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: if statement vars from xml, length unknown

  1. #1
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127

    if statement vars from xml, length unknown

    Hi,
    I read up a bunch of vars and pop them in arrays to use in a series of if statements. That works fine. Right now I have a fixed number of items so I can just write the code below.
    How could I set this up to work so that it could deal with any number of items in the arrays.
    The length of all the arrays will always be the same.
    It could even be one array I think, as items could be fed in in order.
    Thanks in advance, Mark
    PHP Code:
    addEventListener(Event.ENTER_FRAMEloop);

    function 
    loop(e:Event):void {
        if (
    this.currentFrame==1) {
            if ((
    videomask_mc.height != vidHeightArray[1]) && (_ds.time >= startPoint[1]) && (_ds.time endPoint[1])) {
                
    TweenMax.to(videomask_mc.5, {height:vidHeightArray[1]});
                
    TweenMax.to(video.5, {y:vidBase topCropArray[1]});
                
    TweenMax.to(controller_mc.5, {y:masky vidHeightArray[1]});

            }
            if ((
    videomask_mc.height != vidHeightArray[2]) && (_ds.time >= startPoint[2]) && (_ds.time endPoint[2])) {
                
    TweenMax.to(videomask_mc.5, {height:vidHeightArray[2]});
                
    TweenMax.to(video.5, {y:vidBase topCropArray[2]});
                
    TweenMax.to(controller_mc.5, {y:masky vidHeightArray[2]});

            }
            if ((
    videomask_mc.height != vidHeightArray[3]) && (_ds.time >= startPoint[3]) && (_ds.time endPoint[3])) {
                
    TweenMax.to(videomask_mc.5, {height:vidHeightArray[3]});
                
    TweenMax.to(video.5, {y:vidBase topCropArray[1]});
                
    TweenMax.to(controller_mc.5, {y:masky vidHeightArray[3]});

            }
        }


  2. #2
    AS3 Mod
    Join Date
    Sep 2007
    Location
    O-H-I-O
    Posts
    2,385
    Are you able to grab a predetermined length before this loop function is called? For example xml_object.length()?

  3. #3
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    I could load all the xml and parse into arrays.
    Then when xml load is done go to next frame where I trigger video connections and most of my other code lives.
    That is where the enterFrame needs to start and call loop.
    So I could know the xml object length, but also the array length which may be easier to work with.

    thanks for the reply
    mark
    Last edited by mgason; 01-25-2010 at 11:32 AM. Reason: more info

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