Professional Web Applications Themes

ToScript() - Coldfusion - Advanced Techniques

the livedocs are littered with examples of converting a coldfusion variable to javascript by means of ToScript(), but it doesn't show any examples of converting to actionscript. I'm trying to figure out when and how you would use this. the docs say the generated script can be passed into flashform attributes. but what's an example of why you might do this, and how would you do it?...

  1. #1

    Default ToScript()

    the livedocs are littered with examples of converting a coldfusion variable to
    javascript by means of ToScript(), but it doesn't show any examples of
    converting to actionscript. I'm trying to figure out when and how you would
    use this. the docs say the generated script can be passed into flashform
    attributes. but what's an example of why you might do this, and how would you
    do it?

    Shiny7 Guest

  2. #2

    Default Re: ToScript()

    If you were writing some onClick in the actionscript that looped over an
    array of values, maybe to add to a select list. You could use ToScript to
    generate the string that is the actionscript array. The only difference
    between the javascript and the actionscript version is that the javascript
    uses "= new Array()" and "= new Object()" but the actionscript uses the
    shortcuts "= []" and "= {}", because new is a reserved word in flash forms.

    --nimer


    "Shiny7" <webforumsuser@macromedia.com> wrote in message
    news:cvnmkr$4af$1@forums.macromedia.com...
    > the livedocs are littered with examples of converting a coldfusion
    > variable to
    > javascript by means of ToScript(), but it doesn't show any examples of
    > converting to actionscript. I'm trying to figure out when and how you
    > would
    > use this. the docs say the generated script can be passed into flashform
    > attributes. but what's an example of why you might do this, and how would
    > you
    > do it?
    >


    Mike Nimer Guest

  3. #3

    Default Re: ToScript()

    f
    rubystar@hotmail.com Guest

  4. #4

    Default Re: ToScript()

    so how can we pass a an actionscript date object into a component? using toScript always uses new Date(), which is illegal in cf7
    Shiny7 Guest

  5. #5

    Default Re: ToScript()

    You would use FlashRemoting to pass from Actionscript to CF, either way
    actually. Not toScript().

    With the flash forms we compile cf to flash, this is the only place. So the
    actionscript you place in an onClick="" attribute is compiled right into the
    actionscript. This is when you want to use the actionscript version of
    toScript(). For regular CF->Flash transfer of data you would use Flash
    Remoting instead.

    ---nimer




    "Shiny7" <webforumsuser@macromedia.com> wrote in message
    news:d08qgv$dug$1@forums.macromedia.com...
    > so how can we pass a an actionscript date object into a component? using
    > toScript always uses new Date(), which is illegal in cf7

    Mike Nimer Guest

  6. #6

    Default Re: ToScript()

    i guess the underling question is... how to create a date object in flash
    forms. cf is gonna cry when using the actionscript 'new Date()' because
    of the illegal use of the 'new' keyword in flash forms. I'm not sure how else
    to create a date object in actionscript.

    Shiny7 Guest

  7. #7

    Default Re: ToScript()

    Has anyone figured this out yet? I need to set the date in actionscript in a flash form. Is it even doable?
    xivic Guest

  8. #8

    Default Re: ToScript()

    yeah, don't use flash forms.
    Shiny7 Guest

  9. #9

    Default Re: ToScript()

    Shiny7, I figured out how to use the date. You need to use Date.toSring(). I
    posted the complete solution here:

    http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=7&thread
    id=1056858&forumid=1

    xivic Guest

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139