A Flash Developer Resource Site

Results 1 to 18 of 18

Thread: 2 flash file in one page

  1. #1
    Junior Member
    Join Date
    Jun 2001
    Posts
    6
    Dear Friends ;
    I want to write an action in flash with these detail :

    There is 2 swf file in one page (or in two different frame shown in one page).
    There is a Button in one of these files and when someone clicked on this button, an animation played in another one.
    Or in a simple action : when a button clicked on one flash file, "Goto Next Frame" played on other flash file.
    How can I do this ?

    Really thanX for your attention.
    Arian

  2. #2
    This methode is called LocalConnection and is only for flash MX, it can de done in Flash5 but with javascript and html, all lots of hassel, localconnection is quick and easy, heres how it works:

    You have 2 flash files, a reciever, which recievers the data and a sender which send the data.

    The sender would be your swf with the button, so on the first frame of your button movie put this code:

    Code:
    connection = new LocalConnection()
    Then behind your button put this code:
    Code:
    on(Release){
    connection.send("menu", "goTo", 3)} //3 is the frame number of where you want to go on the reciever
    On the reciever swf put this code on the main timeline:
    Code:
    connection = new LocalConnection();
    connection.goTo = function(frame) {
    	gotoAndPlay(frame);
    }
    And voila, the connection is made and your movie will go to another frame number.

    I now have to go, I'll be back in a hour, if you need any help or more info on the code or maybe a demo, just yell

    Xeno.

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

    resolved

    Dear Xeno,
    Thanks for your instant replay,
    I checked your code and I used them in Flash MX but it didn't work.
    Please visit this URL :

    http://www.sirang.net/xeno/index.htm

    I put my FLA files (Both sender and receiver) in this URL for download,
    I know it will take your time, but I need your help to set this action on my project.

    Thanks again,
    regards,
    Arian
    [Edited by _arian_ on 09-02-2002 at 04:22 AM]

  4. #4
    Ok, I'll take a look as soon as I can, probaly later today becuase I have some other projects to help to

    Xeno.

  5. #5
    Ok here it is, up and running

    Forgot to give you the connect command, so all was right on your side, you only didn't lay the final link between the 2.

    Here is the preview:

    http://users.pandora.be/eclips/help/...n/preview.html

    Here are the 2 files:

    http://users.pandora.be/eclips/help/localconn/menu.fla
    http://users.pandora.be/eclips/help/...onn/sender.fla

    Xeno.

  6. #6
    Member
    Join Date
    Sep 2002
    Posts
    50
    I have the answere, I DO that in my site, take this example:

    http://www.sfa-news.com/christian/files/control.zip

    it works just fine, the problem is when you put a buttom inside of a MC, I dont know why donsen't work.

    But if the buttom is out side you have a perfect interactivity between both SWF files.

    Chris

    PS. tell me if you know how to make that the buttom inside MovieClip WORKS!

  7. #7
    Member
    Join Date
    Sep 2002
    Posts
    50
    XENO

    You can tell why if you put the buttom SENDER inside a movie click dosen't work?, Whyt can I do? ( HOW )

    THANK YOU!

    ps:www.sfa-news.com/christian/files/control.zip

  8. #8
    Chris,

    I see that you are trying to make this with javascript, this not used anymore in Flash MX, now the new function "Localconnection" is used istead which is purely flash and has alot more useability.

    If you want I will make you movie with localconnection.
    As I understand you want to click on the colors which are buttons and that the color swf changes to that color, right?

    Lemme know,
    Xeno.

  9. #9
    Member
    Join Date
    Sep 2002
    Posts
    50
    Thank you soo much for your help XENO

    - Right I what to change the colors.

    1.- I have a control panel SWF

    2.- I have the film SWF

    The file I made it works find, but when I put one buttom from the control panel inse of a Movie Clip dont work.

    I try to make this whit FLASH 5 coz I tink like this is not necesary to download the new plug-in, can you hel me to do this whit flash 5 plz?

    Thanks in advance.
    Chris

  10. #10
    Ok, Lemme try a few things, be warned though I have never tried this with java so first I gotta look at how its build up.

    Xeno.

  11. #11
    Member
    Join Date
    Sep 2002
    Posts
    50

    Smile

    ok thanks.

    The KEY in the html file is:

    <SCRIPT LANGUAGE=JavaScript>
    function go() {
    javavar = document.menu.GetVariable("labeltogo");
    document.background.TGotoLabel("/",javavar);
    }
    </SCRIPT>
    -------
    * menu = menu.swf
    * background = background.swf
    -------
    THIS IS REALLY IMPORTANT
    And don't forget to put the: ID (id="menu") in both swf files

    ********************************



  12. #12
    Ok, this is the fix, very simpel:

    On the button in the movieclip you put the same code as all the buttons, including the variable "labelgoto", BUT when you put a button inside a MC its structure changes, meaning that he searches for the labelgoto variable inside the mc, but the variable is on the main timeline, so goto the actions of the button inside the movieclip and give it this script:
    Code:
    on (release) {
    	_root.labeltogo = "rojo";
    	getURL("javascript:go()");
    }
    I have put "_root." in front of the variable, so now it goes and locates it on the main timeline (where it is) instead of the mcs timeline.

    Xeno.

  13. #13
    Member
    Join Date
    Sep 2002
    Posts
    50

    Smile

    Thank you

    YOU ARE THE BEST !



  14. #14
    No problem

    Xeno. (The Human Loving Alien(((moewhahahhahaha, hissssss))))

  15. #15
    Junior Member
    Join Date
    Oct 2001
    Posts
    1

    another example of localConnection between HTML frames

    Hi all,

    Here's another example of localConnection in use between multiple HTML frames.
    This uses the exact same method that Xenomorph used in his examples. The only difference is that these use multiple localConnections to target two .swfs simultaneously.
    Perhaps they'll be of some use to someone.

    Preview:
    http://www.customartprints.com/local...tion/index.htm

    Download:
    http://www.customartprints.com/local.../lc_frames.zip (71kb)
    (I've included the html documents along with the .fla files.)

    Now, what I'd really like to see is someone figure out a method to add a history array that enables the browser's Back and Forward buttons to function properly despite all of the separate HTML frames!
    Any ideas? (Is that even possible?)

    Best of luck,
    -KDS-Djembe

  16. #16
    Member
    Join Date
    Sep 2002
    Posts
    50

    Re: another example of localConnection between HTML frames

    I can't download the FILES.

    You can check the link PLZ, or email me the files.

    Thank you.

    c4hexen@excite.com

  17. #17
    Euhm, I don't think that your back and forth buttons of your browser can be used to target anything besides the normal history of your visited pages. What maybe could work is when flash creates dummie files in the history somehow, but then we first have to fully kno how IE and NN work.

    Difficult thing I guess...

    Xeno.

  18. #18
    Junior Member
    Join Date
    Jun 2001
    Posts
    6
    Dear Xeno,
    Thank you so much for your kind attention,
    I found how to do that with your great help,

    Regards,
    _Arian_

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