A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [

  1. #1
    Junior Member
    Join Date
    Mar 2001
    Posts
    1

    Wink

    Is it possible for one swf to talk to another....like give an action in one movie to go to another movie, and play from a particular frame.

    Also will we need any special code if we are using frames..and will we need javascript

    Could one of you gurus out there write a detailed tutorial on this

    Thanks in advance
    Ronster7, Newbie








  2. #2
    Senior Member sxdesign's Avatar
    Join Date
    Aug 2000
    Location
    Serbia
    Posts
    844
    well... i wrote many times info on it... so i'm kinda lazy to write it again... search here and on we're here forums for javascript/flash javascript/actionscript etc. and you will find plenty of explanations there... (i think that i posted yesterday one similar post)...

    check threads before you ask question...

    cheers...


  3. #3
    Member
    Join Date
    Sep 2000
    Posts
    91

    resolved

    Originally posted by sxdesign
    check threads before you ask question...
    I agree with you, but if everybody would do so, it would be very quiet here...I think everything is at least covered three times here.

    Greets Eye.

  4. #4
    Member
    Join Date
    Sep 2000
    Posts
    50
    Hi,

    The movie can be loaded using the load movie action into some level.
    then its properties can be accessed like this..

    for eg , if the movie was loaded onto level 10 then,

    tell target("_level10)
    go to and play("begin")
    end tell target
    will make the movie to play frame "begin".
    Basically when the movie is loaded onto a level .. it starts acting as a movie clip.So whatever you can do on a movie clip can be done to a movie loaded onto a level.
    Hope that helps

    Naveen

  5. #5
    Senior Member sxdesign's Avatar
    Join Date
    Aug 2000
    Location
    Serbia
    Posts
    844
    naveen_nv,
    he asked how to communicate between 2 .swfs on same html page...

    Could one of you gurus out there write a detailed tutorial on this
    i'll write u simple one... then look back at threads, to get more advanced functions...

    k... put this in your html file, between <head> and </head> tags:

    Code:
    <script language="JavaScript">
    var mNameOne = "moviename_a";
    var mNameTwo = "moviename_b";
    function mObject(mName){
    if (navigator.appName.indexOf ("Microsoft") !=-1){
    return window[mName];
    }
    else{
    return document[mName];
    }
    }
    function gotoFrame_M1(framenr) {
    mObject(mNameOne).TGotoFrame("/", framenr-1);
    }
    function gotoFrame_M2(framenr) {
    mObject(mNameTwo).TGotoFrame("/", framenr-1);
    }
    </script>
    now you need to make some changes in your first .swf callin script:

    in <object tag line add: ID="moviename_a"
    in <embed tag line add: name="moviename_a" swliveconnect=true

    and same for the second .swf, but add there:

    in <object tag line add: ID="moviename_b"
    in <embed tag line add: name="moviename_b" swliveconnect=true

    now... when you want to "command" from first movie where to go second movie you will use:
    Code:
    on (release) {
    GetURL("JavaScript:gotoFrame_M2(frame);");
    //where frame  is the frame where you want second movie to go
    }
    and when you want oposite (to controll first .swf with second) you will use:
    Code:
    on (release) {
    GetURL("JavaScript:gotoFrame_M1(frame);");
    //where frame  is the frame where you want second movie to go
    }
    TGotoFrame function is one of the built in functions.... there is also Set Variable, PercentLoaded and many others... for full list check macromedia's site...

    hope it helps...


  6. #6
    ActionScriptShooter
    Join Date
    Nov 2000
    Posts
    259
    hi,

    what r u talking man (naveen) this guy is looking for something like this. http://astha_online.tripod.com/jsd.htm and the source for this is http://astha_online.tripod.com/jsdemo.zip

    This example has two different movies in two seperate frames (html) and navigation movie (html frame) controls the other movie. there is also another frame containg java code giving actions to the movie in other frame.

    take care,

  7. #7
    Junior Member
    Join Date
    Apr 2001
    Posts
    3

    Script not working on Macs

    SX--

    The code works flawlessly on the PC side..but what about Mac? I am getting script errors on Mac IE 5....

    Any solutions?

  8. #8
    Senior Member sxdesign's Avatar
    Join Date
    Aug 2000
    Location
    Serbia
    Posts
    844
    i think that i explained that before... those methods DON'T work on (and you cannot make it to work):

    ALL IE on Macs
    Netscape 6 (all platforms)
    Opera 4.x

    hope it's more clear now...


  9. #9
    Junior Member
    Join Date
    Apr 2001
    Posts
    3

    Does a solution exist?

    Is there a solution out there using another method?


  10. #10
    i've trying to help this thread ...

    http://board.flashkit.com/board/show...hreadid=126496

    but i'm not so good, maybe someone of you can

    I think you can sxdesign

  11. #11
    Senior Member sxdesign's Avatar
    Join Date
    Aug 2000
    Location
    Serbia
    Posts
    844
    not if you don't want to involve backend scripting (Perl, PHP, JSP... all of them can handle this simple things (although Perl can do much much more )), and possibly some socket (would work better with socket)... so you can always make your movies to send/recieve data from backend scripts, and to make them communicate on that way... that solution will work in ANY browser that supports flash plugin...

    hope it helps...


  12. #12
    Junior Member
    Join Date
    Dec 2000
    Posts
    27
    sorry.....i don't understand this point.....where i can make this changes.....sorry for my bad english....i'm italian......so u can help me ? pleeeeease!!


    now you need to make some changes in your first .swf callin script:

    in <object tag line add: ID="moviename_a"
    in <embed tag line add: name="moviename_a" swliveconnect=true

    and same for the second .swf, but add there:

    in <object tag line add: ID="moviename_b"
    in <embed tag line add: name="moviename_b" swliveconnect=true

    now... when you want to "command" from first movie where to go second movie you will use:

  13. #13
    Junior Member
    Join Date
    Dec 2000
    Posts
    27
    now i understand.....but seem to not function properly...gimme an error page msg when i press the button..... bah!

  14. #14

    server-side how??

    Originally posted by sxdesign
    not if you don't want to involve backend scripting (Perl, PHP, JSP... all of them can handle this simple things (although Perl can do much much more :) )), and possibly some socket (would work better with socket)... so you can always make your movies to send/recieve data from backend scripts, and to make them communicate on that way... that solution will work in ANY browser that supports flash plugin...

    hope it helps...

    was doing research and found your quote -- i have a question if you wouldn't mind reading on.

    i understand how to send variables to a server script from one .swf, and how the script can process the variables, but how can the second .swf receive those variables?

    you suggested it would be easier using a socket. i assume that means using the XML object in flash 5? i'm trying to do it using flash 4.

    thanks so much

  15. #15
    Junior Member
    Join Date
    Feb 2001
    Posts
    2
    Originally posted by naveen_nv
    Hi,

    The movie can be loaded using the load movie action into some level.
    then its properties can be accessed like this..

    for eg , if the movie was loaded onto level 10 then,

    tell target("_level10)
    go to and play("begin")
    end tell target
    will make the movie to play frame "begin".
    Basically when the movie is loaded onto a level .. it starts acting as a movie clip.So whatever you can do on a movie clip can be done to a movie loaded onto a level.
    Hope that helps

    Naveen

    I have two movie files, and I loaded movie #2 into movie #1. From movie #1 am I able to control a movie clip that is inside movie #2 by the touch of a button? If so how?

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