Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Senior Member diciccod's Avatar
    Join Date
    Jan 2004
    Location
    East Lansing, MI... Michigan State!
    Posts
    121
    Member #
    4678
    If i want to pull in the current .html document that the SWF is loaded on and put it in a variable how could i do that.

    I have a flash header for my site and i want it to say something different for each page of the site but i dont want to duplicate the flash six times because of obvious reasons.

    And i figure if i can pull what page it is on then i can use a "switch" or an "if" statement to load different content for each page.

    if (_url.=="index1.html") {
    attachMovie("blah", "none")
    }
    else { getURL("http://aol.com") }


    there is the code i have so far, i am wondering what i need to put after "_url." i need some help

  2.  

  3. #2
    Senior Member energizze's Avatar
    Join Date
    Oct 2002
    Posts
    260
    Member #
    238
    Action script has XML support built into it, so just load the HTML page into an XML object and then you can find bits of information really easily.

    Aslong as the HTML code is kindof conventional and is all inside a pair of <html> tags, then there's nothing to stop you treating it like XML data.


    Code:
    function LoadPage(){
    	
    htmlpage = new XML();
    htmlpage.onLoad = DataIn
    htmlpage.load(_url);
    
    }
    
    
    function DataIn(){
    
    //Put XML handling stuff here
    
    }

  4. #3
    Senior Member
    Join Date
    Mar 2004
    Posts
    241
    Member #
    5465
    You could put your flash header in a frame and your content in another. On a button press you could gotoandPlay() whatever frame ya know, and you could getURL(javascript action) to have that frame go to the proper frame as well. This would avoid having to use variables and all that stuff completely.

  5. #4
    Senior Member diciccod's Avatar
    Join Date
    Jan 2004
    Location
    East Lansing, MI... Michigan State!
    Posts
    121
    Member #
    4678
    Quote Originally Posted by energizze
    Action script has XML support built into it, so just load the HTML page into an XML object and then you can find bits of information really easily.

    Aslong as the HTML code is kindof conventional and is all inside a pair of <html> tags, then there's nothing to stop you treating it like XML data.


    Code:
    function LoadPage(){
    	
    htmlpage = new XML();
    htmlpage.onLoad = DataIn
    htmlpage.load(_url);
    
    }
    
    
    function DataIn(){
    
    //Put XML handling stuff here
    
    }

    Ok, so once i have all of the html data available how can i reference something to the name of the .html document the browser is currently pointed to.

  6. #5
    Senior Member energizze's Avatar
    Join Date
    Oct 2002
    Posts
    260
    Member #
    238
    Code:
    getURL('javascript:document.movie.SetVariable("/:myloc",window.location.href);', '_self')
    That will execute a piece of javascript that will copy the javascript value window.location.href to the flash movie variable _root.myloc

    for this to work the value of the 'id' parameter of the <object> tag below has to be the same as the '.movie' part above.

    e.g.
    getURL('javascript:document.movie.SetVariable("/:myloc",window.location.href);', '_self')

    <OBJECT classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
    WIDTH="550" HEIGHT="400" id="movie" ALIGN="">


    so:

    put:
    Code:
    getURL('javascript:document.movie.SetVariable("/:myloc",window.location.href);', '_self')
    as action script code inside the flash movie.

    and make sure the ID tag in the below code is the same as in above code:
    Code:
    <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
     codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
     WIDTH="550" HEIGHT="400" id="movie" ALIGN="">
     <PARAM NAME=movie VALUE="movie.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED  src="movie.swf" quality=high bgcolor=#FFFFFF  WIDTH="550" HEIGHT="400" NAME="Untitled-1" ALIGN=""
     TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
    </OBJECT>

    Then once you execute that piece of action script code, the address of the html document the movie is in will be in the actionscript variable _root.myloc.


    This is a pretty long winded way of doing a simple task, but that's action script all over I'm affraid.

    I might have missed something obvious here, like a variable in the flash movie that tells you this, but I couldn't see anything that did it in any of the reference files.

  7. #6
    Senior Member diciccod's Avatar
    Join Date
    Jan 2004
    Location
    East Lansing, MI... Michigan State!
    Posts
    121
    Member #
    4678
    skimmed over it, looks like it makes good enough sense. Thanks a lot, ill let you know of the results soon.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 01:50 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com