dcsimg
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Fundamental BUG in Javascript Action?

  1. #1
    Junior Member
    Join Date
    Jun 2001
    Posts
    18
    I'm using the latest Build - SWISH 2 --2001.8.15--

    Follwing the HELP instructions on the "Javascript" action...

    1) I defined an "OnPress" event for a Text element.
    (just the word: "Text")

    2) I selected the "Javascript" action.

    3) The "Javascript" dialog box opens, BUT...
    something strange already, the gray banner on top
    of the area where I'll input my JS code,
    ALREADY shows:

    Javascript ""

    That's the word: Javascript, followed by a space and then 2 successive double-quotes. Swish forced the 2 double-quotes!

    That is slightly different than the example shown on the Swish HELP Topic. (which shows Javascript: <--colon!)

    4) When I enter my test Javascript:

    alert("Hello World!")

    in the space provided, I end up with this apparently wrong string in the action:

    Javascript "alert("Hello World!")"

    Obviously, when tested in the external browser (IE5.5),
    no alert box is shown.

    I believe that SWISH 2.0 forces the extra set of double quotes -on the outside- of the expression...The double-quote BEFORE the word: alert, and the double-quote AFTER the closing parenthesis.



    Again, the 2 external double-quotes are FORCED initially by SWISH and you can't get rid of them. So, the JS expression does not work in the browser...

    Help!

    Ray
    IE 5.5, Win ME, 1Ghz DELL, 512 RAM.








  2. #2
    Senior Member
    Join Date
    Jul 2000
    Posts
    2,545

    Not sure if this will help you or not

    but you can input your JS into the goto URL field instead. Using this method doesnt force any unwanted JS on you. Just select your mouse event.......ie Onpress, goto URL (Input your JS into the field) and your set.

    ~Jer~

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

    OK! Now it works...

    It seems to work now, when previewed in the browser.

    I noticed that when you select in SWISH: "Test in Browser" -
    you have to remember to refresh the browser
    (--> F5 in IE 5.5).

    Then, and only then, you'll see the latest version
    of your Movie.

    Anyhow, when I forced a "refresh" in IE 5.5,
    the JavaScript Alert Box showed up correctly.

    Ray

  4. #4
    SWiSHer extraordinaire
    Join Date
    Dec 2000
    Location
    Australia
    Posts
    3,900
    Gees .. I can't win, can I

    People where complanning that the way the javascript action looked in the action tree was misleading, because it looked too much like the action javascript, but had an extra space

    So I changed it to be like the other actions:eg

    Goto URL "http://xxxx.com"

    etc, where we have the action name, and then the value supplied for the action in quotes. Noone seems to have a problem with this for all the other action. They don't think that we are sending the URL Goto URL "http://xxxx.com" to the browser

    But, for some reason, as soon as it is the Javascript action, people get confused and think SWiSH is sending the url Javascript "alert("hello");" to the browser !!

    All this indicates is that there is a 'Javascript' action there in the action tree, and that the javascript it is sending is alert("hello");

    Maybe SWiSH should list the actions in the action tree more like actionscript does, and show things like
    GotoUrl("http://xxxx.com");
    Javascript("alert(/"hello/");");
    etc
    These aren't as friendly though.

    Well, certainly for the time being at least, things will stay as they are.

    I hope you understand what's going on now.

  5. #5
    Junior Member
    Join Date
    Jun 2001
    Posts
    18
    Yes, I do understand now, Roger. Thanks!
    (I was not aware of the previous polemic discussion on
    how to represent Javascript calls inside the Swish tree).

    I guess that the reason that led me to think that my simple
    JS test expression:

    alert("Hello World")

    did not work, was that when I selected "Test in Browser"
    (from SWISH 2), the IE 5.5 browser did not show the popup Alert window after I clicked on the trigger word "Text".

    Why? Because called in this way, IE 5.5 was showing the previous, cached, non-JS script version of the Movie.
    Only the word: "Text" showed but nothing happened when I clicked on it.

    But...after I "refreshed" in IE 5.5 (via F5), the browser showed the Updated version of the Movie, and everything worked fine...the popup window appeared correctly after I clicked on the word: "Text".

    Natural follow-up QUESTION: *************************
    Is there a way to have IE 5.5 show the LATEST version of the Movie (each time), after I select "Test in Browser" from SWISH 2?

    (Right now, IE 5.5 seems to show the previous, cached version of the Movie, when called from SWISH via "Test in Browser").



  6. #6
    SWiSHer extraordinaire
    Join Date
    Dec 2000
    Location
    Australia
    Posts
    3,900
    I've added some meta-tags to the Test in Browser that hopefully should stop the browser from using the previous version. This is all a bit of a black-art to me .. but according to the info I have, this should work.

    Look forward to this being fixed in the next update (probably in a few days).


  7. #7
    Junior Member
    Join Date
    Jun 2001
    Posts
    18
    Thank you, Roger!
    (You guys are SUPERB).

    Looking forward to the next Build with
    the "black magic" html tags that force IE5.5
    to display the latest version of the Movie,
    after the user selects "Test in Browser".

    (Maybe you should post to this thread
    when the new Build is ready for testing).

    Will test the correction and post the results
    in this same thread, for the benefit of others.

    Ray

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