A Flash Developer Resource Site

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Oct 2003
    Posts
    3

    Javascript to call an swf?

    Hi,

    I have what I think is a reasonably simple reuirement. I have a simple site consisting of a few frames. In one frame is an swf created from swish. This is my menu, from which I call javascript to change pages. All works well.

    However, in one of the html pages I want a call back to the SWF to change the swf (move it onto the next scene for instance). And now I'm stuck!!

    I've referred to Fret's tutorial, but I'm getting confused! I want to call the swf change from an onClick event by calling a function that changes the swf and other pages (function is in place).

    Can someone help? My code as things stand is:

    This is the movie setup:
    Code:
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" 
    width="207" height="468">            
                <param name="movie" value="files/left.swf">
                <param name="quality" value="high">
                <embed src="files/left.swf" quality="high"
    pluginspage="http://www.macromedia.com/go/getflashplayer"
    type="application/x-shockwave-flash"
    width="207" height="468" SWLIVECONNECT="True" NAME="left">
    </embed></object>
    This is my function:
    Code:
    function launchApp(appname){
    
    top.left.left.TGotoFrame(24);
    top.main.location.href="welcome_app.htm";
    top.bottom.location.href="bottom_app,htm";
    
    }
    Many thanks!

    Edited to fix word-wrap
    Last edited by Dead Rabbit; 10-23-2003 at 11:06 AM.

  2. #2
    Junior Member
    Join Date
    Oct 2003
    Posts
    3
    using swishmax if relevant , and IE browser only (6)

  3. #3
    Super Moderator Frets's Avatar
    Join Date
    Oct 2000
    Location
    flashkit
    Posts
    8,781
    hmm

    You script makes sense
    and it should be valid.

    Instead of top try _parent or window

    You should be able to achieve it
    without calling the parent frame however


    btw your object name is movie

    here <param name="movie"
    If you want NN users to be able to
    use it as well insert
    NAME="movie" to the embed portion (it may be part of your
    clean up.

    ergo your target should be
    left.movie.TGotoFrame(24);

    If the movie is within a div tag you'll have to identify
    the div <div id="divname">
    and include the div in your addressing.
    as in
    Code:
    window.left.divname.movie.GotoFrame(24)
    The T in the code stands for target as in tell target
    If you aren't targeting a specific sprite or level
    stick with GotoFrame other wise you'd have to call the
    target first ("_level01/",24)


    see how that works out for ya

    Frets

  4. #4
    Junior Member
    Join Date
    Oct 2003
    Posts
    3
    Thanks Frets - using your iframe tutorial and the scripting one I managed to figure it out in the end.

    Really appreciate the help - what a great place this is! Something tells me I will be back!

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