A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [CS4] JSFL problems AGAIN

  1. #1
    Señor Member Mavrisa's Avatar
    Join Date
    Oct 2005
    Location
    Canada
    Posts
    506

    [CS4] JSFL problems AGAIN

    Alright, so I'm branching off a bit from Lee Brimlow's tutorial on Creating Custom Flash Panels, and I'm trying to have it set the default stroke and fill colours as well. Here is the code I was trying to use:

    var jsfl:String = "var doc:document = fl.getDocumentDOM();var fill:fill = doc.getCustomFill('toolbar');fill.style = 'solid';fill.color = 0x" + colour.toString(16) + ";doc.setCustomFill(fill);";
    MMExecute(jsfl)



    But I keep getting the following error:

    The following JavaScript error(s) occurred:

    SyntaxError: missing ; before statement


    I then decided to see if it was the fault of my colour (which is a uint, holding the hex value of the colour) variable, so I set it to this:

    var jsfl:String = "var doc:document = fl.getDocumentDOM();var fill:fill = doc.getCustomFill('toolbar');fill.style = 'solid';fill.color = 0x000000;doc.setCustomFill(fill);";
    MMExecute(jsfl)


    And still got the same error! What am I doing wrong?
    Haikus are easy
    But sometimes they don't make sense
    Refrigerator

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    That was one annoying movie. NOTHING happened for the first 45 seconds, and then stuff started going at a snail's pace. A written tutorial with screenshots would have been much better.

    Anyway. JSFL is Javascript, not Actionscript. As such, the type declarations should not be present.

    Code:
        var jsfl:String = "var doc = fl.getDocumentDOM();var fill = doc.getCustomFill('toolbar');fill.style = 'solid';fill.color = 0x" + colour.toString(16) + ";doc.setCustomFill(fill);";
        MMExecute(jsfl);

  3. #3
    Señor Member Mavrisa's Avatar
    Join Date
    Oct 2005
    Location
    Canada
    Posts
    506
    Haha sorry about the tutorial :P A lot of them are really helpful, if a bit slow...

    Anyways. That worked wonderfully, thank you very much.
    Just wondering though. If Javascript is just another dialect of ECMAScript, then why is the typing different?
    Haikus are easy
    But sometimes they don't make sense
    Refrigerator

  4. #4
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Actionscript is actually the odd man out in that regard. Standard ECMAScript and Javascript are, not exactly untyped, but dynamically typed. Actionscript 3 adheres to a proposed standard for ECMAScript 4 (and Javascript 2) which I think is vastly technically superior, but was shot down for political reasons by Microsoft.

  5. #5
    Señor Member Mavrisa's Avatar
    Join Date
    Oct 2005
    Location
    Canada
    Posts
    506
    Dang ol' Microsoft. I'd have to agree with you, static typing just feels... right. And of course it's probably loads faster. Anyways, thank you for all your help.
    Haikus are easy
    But sometimes they don't make sense
    Refrigerator

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