Welcome, Guest
  • Author Topic: Need help to load multiple external swf files  (Read 2877 times)

    vishal

    • Server what's that
    • *
    • Posts: 12
      • View Profile
      • Email
    --------------------------------------------------------------------------------
    I have started a flash chat application where i need to open a multiple swf files on clicking  on the available users.I have used loadMovie and getURL methods,but not up to the mark.

    Need some help on how to open an external swf file from the parent (swf) file .and how to bridge the communication in between them

    it will be helpful if somebody gives me example

    Vishal

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Need help to load multiple external swf files
    « Reply #1 on: 03/29/03, 04:29 »
    If the movies are in the same page, you can use a local connection object http://www.macromedia.com/support/flash/action_scripts/local_connection_objects/ to comunicate between them.

    If they're in different pages, you ned to use JavaScript, specially the opener property of the window object that give you a reference to the window that has open the pop up. Anyway, heavy based in JavaScript your app is not recomendable, why not to open windows in the main movie?

    Jorge

    vishal

    • Server what's that
    • *
    • Posts: 12
      • View Profile
      • Email
    Re: Need help to load multiple external swf files
    « Reply #2 on: 03/29/03, 06:18 »
    first thanks for the immediate response,here i have two files login.swf and pop_up.swf and clicking on the particular user i have to open pop_up.swf with that particular username.

    So can u tell how can i open an external (pop_up.swf) file from the the parent(login.swf)file and also how should i open multiple windows.I have tried loadMovie and getURL,but cannot achieve what i want,It will really nice if u can send me an live example where u can open "extenal and multiple swf files".


    vishal

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Need help to load multiple external swf files
    « Reply #3 on: 03/29/03, 08:35 »
    The problem is that you can't usually open more than one window from a single page, for multiple open you need to make some sort of "cascade". If you have a maxnumber of two users at same time, could be done passing parameters from one window to another, but more than that is very tricky. How many windows you need to open?

    Jorge

    vishal

    • Server what's that
    • *
    • Posts: 12
      • View Profile
      • Email
    Re: Need help to load multiple external swf files
    « Reply #4 on: 03/31/03, 00:34 »
    i want it to work similar to yahoo messenger i have converted the displayed user as button and on clicking the button i should show the pop up with title saying "Message to so and so"
    will it be possible make a chat application which will works as Yahoo messenger

    vishal

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Need help to load multiple external swf files
    « Reply #5 on: 03/31/03, 01:50 »
    Sure, you can do a chat app using textfiles, databases or socket servers. For socket servers see http://www.flash-db.com/Board/index.php?board=19;action=display;threadid=3509  You can look examples of chat apps in http://www.flashkit.com/search.php?cat=movies&field=Description&per=10&page=1&term=chat&x=37&y=12

    Jorge

    vishal

    • Server what's that
    • *
    • Posts: 12
      • View Profile
      • Email
    Re: Need help to load multiple external swf files
    « Reply #6 on: 03/31/03, 02:56 »
    thanks for u response

    But Jorge i need help for opening the small window, it should open in the same way as we open our yahoo messenger(pop up's).i have tried loadMovie it's getting loaded on to the movie and the getURL command is opening the file in browser.so how do i achieve this task

    vishal

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Need help to load multiple external swf files
    « Reply #7 on: 03/31/03, 03:39 »
    http://www.estudiobaires.com/examples/popup2.swf

    To pop-up a new window with a username, write this to your button:

    getURL("javascript: newWindow('username'");

    In the HTML page this JavaScript function

    function newWindow(username){
       var url ="message.html?username="+username;
       window.open(url, username, 'toolbar=no, location=no, status=no, menubar=no, scrollbars=no, resizable=no, width=100, height=120, left=100, top=100');
    }

    This is the source of the pop-up HTML. It writes dinamically all the Flash OBJECT end EMBED tag. It appends also the variable to the movie, that becomes avaible as any other variable in root ion the message.swf movie

    Quote
    <HTML><HEAD><TITLE>message</TITLE></HEAD><BODY>
    <script language="JavaScript" type="text/JavaScript">
    <!--
    var ref=location.search;
    ref=ref.split("=");
    var user=ref[1];
    var c=">"; // I will use the closing tag more than once
    var oC="<OBJECT classid=\'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\' ";
    var cB=" codebase=\'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\' ";
    var w=" WIDTH=100 ";
    var h=" HEIGHT=100 ";
    var pN=" <PARAM NAME=movie  VALUE="
    var pQ=" <PARAM NAME=quality VALUE=best> ";
    var pW=" <PARAM NAME=wmode VALUE=transparent> ";
    var pB=" <PARAM NAME=bgcolor VALUE=#FFFFFF";
    var bG="#FFFFFF";
    var eS=" <EMBED src=";
    var eQ=" quality=best ";
    var eW=" wmode=transparent ";
    var eB=" bgcolor=";
    var eT=" TYPE=\'application/x-shockwave-flash\' ";
    var eP= "PLUGINSPAGE=\'http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\'> ";
    var eO=" </EMBED> </OBJECT> ";

    // the last step
    var line01=oC+cB+w+h+c+pN;
    var line02=c+pQ+pB+bG+c+eS;
    var line03=eQ+eB+bG+w+h+eT+eP+eO;

    // here is our most crucial variable- pay attention to the "?" at the end of the movie name
    // we append the cookie query string at the end of the movie name
    var movieName ="message.swf?user="+user;

    // write the OBJECT/EMBED tags
    document.write(line01+movieName+line02+movieName+line03);
    // ...done
    //-->
    </SCRIPT>

    </BODY></HTML>


    Jorge
    « Last Edit: 03/31/03, 03:49 by Jorge Solis »