www.webdeveloper.com
Results 1 to 9 of 9

Thread: Passing Variables and Embed tags

  1. #1
    Join Date
    Jan 2004
    Location
    Boston, MA
    Posts
    126

    Passing Variables and Embed tags

    Here is what I am trying to accomplish:

    1. I would like a set of links to pass variables to the pages they are opening.

    Is this the correct way to do this?

    <a href = "somePage.html?variableName=something&otherVariable=something else">Link</a>


    2. Then the page that it calls would use one of those variables in an embed tag.

    Would I write that in like this?
    <object...Stuff here>
    <param name...Stuff here />
    <embed src="flash_detection.swf?flashContentURL="+variableName+"_content.html&altContentURL="+variableName" +_alternate.html ...more/>

    Note the +variableName in the embed scr. Would the variable I passed with the link be inserted here?

    3. Lastly, how would I then pass the second variable associated in the link along to a third page that would open depending on the results of this page?

    These pages are detecting which flash player a user has and redirecting the user accordingly.

    Here is all of the code as written by Flash.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="refresh" content="3;url=preLoader.2_alternate.html" />
    <title>preLoader.2</title>
    </head>
    <body>
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,0,0" width="80" height="80">
    <param name="movie" value="flash_detection.swf?flashContentURL=preLoader.2_content.html&altContentURL=preLoader.2_altern ate.html&contentVersion=7&contentMajorRevision=0&contentMinorRevision=0&allowFlashAutoInstall=false" />
    <param name="quality" value="low" />
    <embed src="flash_detection.swf?flashContentURL=preLoader.2_content.html&altContentURL=preLoader.2_alternat e.html&contentVersion=7&contentMajorRevision=0&contentMinorRevision=0&allowFlashAutoInstall=false" quality="low" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="80" height="80" />
    </object>
    </body>
    </html>

    I haven't changed this version to fit what I am trying to do.

    Thanks for reading the long post.

    _t
    I don't feel tardy.

  2. #2
    Join Date
    Mar 2004
    Location
    Glasgow, Scotland
    Posts
    613
    Can you not use ASP or PHP to build the html with the appropriate variables built in?
    zing

    | Web Design and Development in Glasgow - 404i |
    | Blog |

    Code:
    -. .-.   .-. .-.   .-. .-.   .-. .-.   .-. .-.
    ||x|||\ /|||x|||\ /|||x|||\ /|||x|||\ /|||x|||\ 
    |/ \|||x|||/ \|||x|||/ \|||x|||/ \|||x|||/ \|||
    '   '-' '-'   '-' '-'   '-' '-'   '-' '-'   '-'

  3. #3
    Join Date
    Jan 2004
    Location
    Boston, MA
    Posts
    126
    I have no experience with that. Am I that far off the track here? Shouldn't my link code pass the variable to the next page?

    I've seen this done before, but somewhere it is breaking down on me.

    Thanks for the reply.

    _t
    I don't feel tardy.

  4. #4
    Join Date
    Jan 2004
    Location
    Boston, MA
    Posts
    126
    When passing variables through the url what happens after the first "?" I have noticed that the <embed> tag already has variables that it is passing, so there is a "?" before mine.

    <embed

    src="flash_detection.swf?flashContentURL=preLoader.2_content.html?modName="+modName+"&companyName="+compan

    yName+"&altContentURL=preLoader.2_alternate.html&contentVersion=7&contentMajorRevision=0&contentMino rRevisi

    on=0&allowFlashAutoInstall=false" quality="low"

    pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"

    type="application/x-shockwave-flash" width="80" height="80" />


    Could this be causing the problems? As you can tell I am taking shots in the dark here.

    _t
    I don't feel tardy.

  5. #5
    Join Date
    Mar 2004
    Location
    Glasgow, Scotland
    Posts
    613
    If you have ASP on your server then you can do this for example:

    suppose the link is this:

    <a href="http://www.mydomain.com/target.asp?a_value=000000">link</a>

    then you could do this to the body of your target file (notice the file name is .asp rather .html)

    Code:
    <body text="#<% document.write(request.querystring("a_value")) %>">
    What will happen is the server will, when it sees <% ...code... %> it will perform whatever code lies between these tags. In the above example 'request.querysting("a_value")' will look for what value is associated with 'a_value' on the querystring, in this case '000000'. Document.write will then insert that value into the page that gets sent back to your computer, so that when you look at the source code for target.asp you'll see:
    Code:
    <body text="#000000">
    giving you black text.

    PHP can do the same thing although the syntax is different.

    If you want to know more then check out a couple of tutorials, such as at www.webmonkey.com or a million other sites.

    Hope this helps
    zing

    | Web Design and Development in Glasgow - 404i |
    | Blog |

    Code:
    -. .-.   .-. .-.   .-. .-.   .-. .-.   .-. .-.
    ||x|||\ /|||x|||\ /|||x|||\ /|||x|||\ /|||x|||\ 
    |/ \|||x|||/ \|||x|||/ \|||x|||/ \|||x|||/ \|||
    '   '-' '-'   '-' '-'   '-' '-'   '-' '-'   '-'

  6. #6
    Join Date
    Jan 2004
    Location
    Boston, MA
    Posts
    126
    Thanks for the reply Zing, but learning ASP isn't really what I had in mind right now. Perhaps another day.

    _t
    I don't feel tardy.

  7. #7
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    2,771
    Well, i don't know much of about flash. It's up to the language if it can read the variables being passed. CAN flash gather variables from URLS? I don't know. This is more of a flash question than HTML. If it can't, than you have no choice than to use another language to act as messenger. PHP, ASP, ASP.net I know would work.

  8. #8
    Join Date
    Jan 2004
    Location
    Boston, MA
    Posts
    126
    Flash can gather the variables, but it is not Flash that is not working here. The Flash movie does a simple check then says open html page1 or page2. Where I have the url for html page1 encoded with the variables that again need to be passed, so in effect, Flah isn;t actually reading these variables.

    Is there some code I could put on the pages to see if the variables are being passed properly? Something like document.write(variable1)?

    _t
    I don't feel tardy.

  9. #9
    Join Date
    Jan 2004
    Location
    Boston, MA
    Posts
    126
    Here is the code I am using:

    Links page:

    Code:
    <html>
    <head>
    </head>
    <body>
    <a href = "preLoader.2.html?modName='C1VinylMod2'&companyName='carpetOne'" target = "_blank">Mod1</a>
    <a href = "preLoader.2.html?modName='C1VinylMod1'&companyName='carpetOne'" target = "_blank">Mod2</a>
    </body>
    </html>
    preLoader2.html Page

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="refresh" content="3;url=preLoader.2_alternate.html" />
    <title>preLoader.2</title>
    </head>
    <body>
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,0,0" width="80" height="80">
    <param name="movie" value="flash_detection.swf?flashContentURL=preLoader.2_content.html?modName="+modName+"&companyName="+companyName+"&altContentURL=preLoader.2_alternate.html&contentVersion=7&contentMajorRevision=0&contentMinorRevision=0&allowFlashAutoInstall=false" />
    <param name="quality" value="low" />
    <embed src="flash_detection.swf?flashContentURL=preLoader.2_content.html?modName="+modName+"&companyName="+companyName+"&altContentURL=preLoader.2_alternate.html&contentVersion=7&contentMajorRevision=0&contentMinorRevision=0&allowFlashAutoInstall=false" quality="low" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="80" height="80" />
    </object>
    </body>
    </html>
    And finally the Content Page


    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>OnLine University</title>
    </head>
    <body bgcolor="#ffffff" topmargin = 0, leftmargin = 0, marginheight = 0, marginwidth = 0>
    <center>
    <script language="JavaScript">
    <!--
    var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
    // Handle all the FSCommand messages in a Flash movie.
    function preLoader.2_DoFSCommand(command, args) {
    	var preLoader.2Obj = isInternetExplorer ? document.all.preLoader.2 : document.preLoader.2;
    	//
    	if(command=="exit"){
    		window.close();
    	}
    	//
    }
    // Hook for Internet Explorer.
    if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
    	document.write('<script language=\"VBScript\"\>\n');
    	document.write('On Error Resume Next\n');
    	document.write('Sub preLoader.2_FSCommand(ByVal command, ByVal args)\n');
    	document.write('	Call preLoader.2_DoFSCommand(command, args)\n');
    	document.write('End Sub\n');
    	document.write('</script\>\n');
    }
    //-->
    </script>
    <!--url's used in the movie-->
    <!--text used in the movie-->
    <!--
    Exit
    Welcome
    to the future.
    AB
    -->
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="preLoader.2" width="640" height="480" align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="movie" value="preLoader.2.swf" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#ffffff" />
    
    <!--**********-->
    <!-- -->
    <!--Fill in the variables here and at the end of the embed src -->
    
    <param name="flashvars" value="modName="+modName+"&companyName="+companyName+"&" />
    
    <embed src="preLoader.2.swf" quality="high" bgcolor="#ffffff" width="640" height="480" swLiveConnect=true id="preLoader.2" name="preLoader.2" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"flashvars="modName="+modName+"&companyName="+companyName />
    </object>
    </body>
    </html>
    Notice that the variables modName and companyName are passed through all three pages in the urls. Am I adding the variables in urls correctly?

    Thanks for everyones time.

    _t
    Last edited by shotsy247; 07-27-2004 at 09:28 AM.
    I don't feel tardy.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles