Load external variables into flash MX

Discussion in 'Programming' started by Fracisc, Aug 23, 2009.

  1. #1
    Hey folks.

    I have this:


    var endDate:Date = new Date(2010,7,20);
    Code (markup):
    I need to change this to be able to set it like this:


    <param name="FlashVars" value="year=2010&date=7&day=20">
    Code (markup):
    How can I do this? How can I change my current line so it reads the values from my flashvars?
     
    Fracisc, Aug 23, 2009 IP
  2. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    kblessinggr, Aug 23, 2009 IP
  3. john.peter

    john.peter Well-Known Member

    Messages:
    307
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    138
    #3
    Hey, we can pass the flashvars using the default method as you posted already.
    You have to change the code like this, (I assumes that the following code is in the stage)
    var endDate:Date = new Date(((this.year == undefined)?2010:this.year;),((this.date == undefined)?7:this.date;),((this.day== undefined)?20:this.day;));
    Its very simple in a single line using ternary operator.
    Let me know if it doesn't help you. I am always here...

    Regards
    John
     
    john.peter, Aug 23, 2009 IP