dcsimg
A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: if - else javascript statement in actionscript window

  1. #1
    Member
    Join Date
    May 2001
    Posts
    42
    this is a javascript i use in html frequently for my site. right now, i am trying to use it in the action script window for a flash movie i am creating

    <script>
    if(document.all){//IE
    javascript:top.viewer.videoplayer.javaPlug1.DoPlay Pause();
    }else{
    javascript:top.viewer.videoplayer.document.javaPlu g1.DoPlayPause();
    }
    </script>

    i can put one of the statements in my flash movie and it will work fine with IE. Netscape, however, wigs out by refreshing the whole window and placing the word "true" in the upper left hand corner. i cant seem to get the whole script (both statments) to work in actionscript and have both browsers be happy. (the script works fine in html.)

    so i dont think im doing this right,(understatment) and im wondering if anyone knows how to transplant this normally html-bound code in to the flash actionscript window and have it behave like a good little code.
    -boc

  2. #2
    Senior Member
    Join Date
    Jun 2000
    Posts
    705
    you might be able to keep your script in your html and just put it inside a function. Then in your flash movie, simply call that function using Get URL.
    This may not solve your Netscape problem, but netscape is now out of business and won't around for much longer. Usage is already down to about 8%
    hope this helps, frank
    http://www.geckoarts.com

  3. #3
    Member
    Join Date
    May 2001
    Posts
    42
    Thanks for the quick response frank, this sounds good. this is what i did.

    function pausetoggle()
    {
    <script>
    if(document.all){//IE
    javascript:top.viewer.videoplayer.javaPlug1.DoPlay Pause();
    }else{
    javascript:top.viewer.videoplayer.document.javaPlu g1.DoPlayPause();
    }
    </script>
    }

    although this didnt work (not sure why) i think it might be best to do some sort of function that will simply re-toogle my doplaypause.
    by the way, i have pausetoggle() in my GetURL line in flash now.

  4. #4
    Senior Member
    Join Date
    Jun 2000
    Posts
    705
    I'D try this in your button, using the get URL action:
    javascriptausetoggle();

  5. #5
    Senior Member
    Join Date
    Jun 2000
    Posts
    705
    sorry thats:
    javascript:pausetoggle();

  6. #6
    Member
    Join Date
    May 2001
    Posts
    42
    (nice smiley face hehe)
    ok, well ive made some modifications but im still having issues getting this to work...here is what my code now looks like

    <SCRIPT LANGUAGE="JavaScript">
    function pausetoggle()
    {
    if(document.all){//IE
    javascript:top.viewer.videoplayer.javaPlug1.DoPlay Pause();
    }else{
    javascript:top.viewer.videoplayer.document.javaPlu g1.DoPlayPause();
    }
    </SCRIPT>

    in flash i have the command you suggested,
    javascript: pausetoggle();

  7. #7
    Senior Member
    Join Date
    Jun 2000
    Posts
    705
    I've been playing with javascript in flash a lot lately. If you don't mind emailing me an example. I'll take a look at it and see if i can figure it out. If its really big, don't worry about it though.
    frank,
    frank@geckoarts.com

  8. #8
    Member
    Join Date
    May 2001
    Posts
    42
    i think that my javascript is off somehow...this should work because im using it in other places. im just not calling to it from a flash movie witha function.

    can someone take a look at this code and see if its correct?

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