A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: if statement

  1. #1
    Junior Member
    Join Date
    May 2001
    Posts
    18
    i have a movie where im trying to do something like MS project where you enter startdate and enddate and itll graph it for you. Its simple :

    frame 1 : input fields d1, m1, y1, d2, m2, y2, calcbutton
    frame 5 : background grid with months, movieclip "bar1"
    actions : f1=stop, f5=setprop _width bar1 to difference in days by a multiplier to make the bar bigger in size.

    I need 2 things:

    A. to add an if to set _x of bar1 to something else when m1 is feb, mar, etc...

    B. what should i use so the bar wont grow in both directions? _xscale or width or what?

  2. #2
    I didn't quite get what u want, but the in the bar1 symbol u have a black cross that is the center of the symbol, when u rotate it or scale it or change is widh, flash will use it has reference point, so I think if u set the center to be in one of the extremeties of the rectangle draw it will make flash to change is width correctly

    By the way, did u resolve the problem ehit bar1 and the variables? the problems was what I said?






  3. #3
    Junior Member
    Join Date
    May 2001
    Posts
    18

    movie

    Can i post the movies up on the board?

    Originally posted by cabanas
    i have a movie where im trying to do something like MS project where you enter startdate and enddate and itll graph it for you. Its simple :

    frame 1 : input fields d1, m1, y1, d2, m2, y2, calcbutton
    frame 5 : background grid with months, movieclip "bar1"
    actions : f1=stop, f5=setprop _width bar1 to difference in days by a multiplier to make the bar bigger in size.

    I need 2 things:

    A. to add an if to set _x of bar1 to something else when m1 is feb, mar, etc...

    B. what should i use so the bar wont grow in both directions? _xscale or width or what?

  4. #4
    Senior Member
    Join Date
    Feb 2001
    Posts
    1,835

    maybe I'm wrong but I think that ActionScript always uses the centre of the object for positioning - whether you use the 'Edit Centre' command or not.

    so to change the width and position it you need something like this:

    Code:
    (this goes in at the start somewhere)
    originalLeftX = bar1._x;
    
    
    (here is where you position it)
    bar1._width = newWidth;
    bar1._x = originalLeftX + bar1._width/2;
    the variable originalLeftX stores the x-coordinate of the left edge of the bar and when you change the width you reposition the bar accordingly, so that the left hand edge of the bar is always at the same x-coordinate.

    --
    as for the if statement, not sure what you are trying to do.
    you should really use a function to calculate the number of days between the two dates and use that to calculate the width of the bar. [IMHO]

    hope this helps - n.

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