Actionscript linking to HTML parameters, can it be done?

This is a discussion on "Actionscript linking to HTML parameters, can it be done?" within the Flash & Multimedia Forum section. This forum, and the thread "Actionscript linking to HTML parameters, can it be done? are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Flash & Multimedia Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jul 25th, 2005, 14:00
Junior Member
Join Date: Jul 2005
Location: Toronto, Ontario. Canada
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Actionscript linking to HTML parameters, can it be done?

Hello everyone, I have a question, but have no idea on how to do this. I have a swf file that I want to upload on to a site, but I want this file on every page of the site, however I dont want to upload dozens of swf files. The problem is each of these flash files will play the same animation, just with different content. Is there anyway for me to use only 1 swf file and have it link to a parameter I set in HTML? If there is anyways this can be done or another route I can take for the same result, please tell me. Thanks in advanced for the help.
Reply With Quote

  #2 (permalink)  
Old Jul 25th, 2005, 14:40
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
You can pass vars to Flash from HTML quite easily.

Code: Select all
<OBJECT classid="..." codebase="..." WIDTH="598" HEIGHT="105" id="explosion" ALIGN="">
                          <PARAM NAME=movie VALUE="explosion.swf">
                          <PARAM NAME=menu VALUE=false>
                          <PARAM NAME=quality VALUE=high>
                          <PARAM NAME=bgcolor VALUE=#EEF0F8>
                          <param name="Flashvars" value="&amp;title=Welcome&amp;noOfKeywords=4&amp;keyword0=Welcome to our website&amp;keyword1=We have many services&amp;keyword2=service details&amp;keyword3=Working hard for you and your business!">
                          <EMBED src="explosion.swf"  WIDTH="598" HEIGHT="105" ALIGN="" menu=false quality=high bgcolor=#EEF0F8 NAME="explosion"	 TYPE="..." PLUGINSPAGE="..." flashvars="&amp;title=Welcome&amp;noOfKeywords=4&amp;keyword0=Welcome to our website&amp;keyword1=We have many services&amp;keyword2=service details&amp;keyword3=Working hard for you and your business!"></EMBED> 
                        </OBJECT>
As you can see I've cut a lot of the code out. What you need to notice are the param name="Flashvars" and EMBED flashvars="...".

Both of those are necessary and need to contain the same information due to the fact that some browsers access the Flash information through the params and others use the embed tag.

All of the flashvars data will be available in your flash file:
Code: Select all
&amp;title=Welcome&amp;noOfKeywords=4&amp;keyword0=Welcome to our website&amp;keyword1=We have many services&amp;keyword2=service details&amp;keyword3=Working hard for you and your business!
As you probably know, $amp; is equivalent to &.
Flash uses the files like this: &var=data.
So if you wanted a var called 'name' and your name was 'mark' you'd do: &name=mark
You can (I believe) have as many variables as you want. You access them directly in Flash as if they were an internal variable, but I believe they are only available on the main stage and not in movieclips, etc.

Hope this helps!
Reply With Quote
  #3 (permalink)  
Old Jul 25th, 2005, 15:06
Junior Member
Join Date: Jul 2005
Location: Toronto, Ontario. Canada
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Thank you very much, this was quite confusing at first, but after looking over it a few dozen times, I understand it and have gotten the hang of it, however I still have a problem because I do not know the functions/code for placing/changing images within the HTML code (I forgot the actionscript also, but I have the code somewhere...). Do I use
<param name="Flashvars" value="&amp;title=""> (with quotes)
or
<param name="Flashvars" value="&amp;title=> (without quotes)
Thanks a lot again.

PS. After further investigating, I found out that I do not know how to load it from flash either . I tried the loadmovie function, but I do not know how I can load it from a variable, can anyone help me with this? Thanks a lot again.
Reply With Quote
  #4 (permalink)  
Old Jul 25th, 2005, 16:13
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
You don't need to use quotes.

And as for loading using a variable, you need:
_root['varname']
Reply With Quote
  #5 (permalink)  
Old Jul 25th, 2005, 16:50
Junior Member
Join Date: Jul 2005
Location: Toronto, Ontario. Canada
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Sirkent
You don't need to use quotes.

And as for loading using a variable, you need:
_root['varname']
I dont quite understand where I am supposed to place the
_root['varname'], when I try to place this inside the loadmovie code, I get an error. What I did was loadMovie(_root['image'],"bg"); I do not know what I am supposed to do... T.T thank you again for the help.
Reply With Quote
  #6 (permalink)  
Old Jul 25th, 2005, 17:14
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
I see no reason why that's shouldn't work.

Use trace to display the variable on the screen to be sure it is right.
Reply With Quote
  #7 (permalink)  
Old Jul 25th, 2005, 17:25
Junior Member
Join Date: Jul 2005
Location: Toronto, Ontario. Canada
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
I placed the code (loadMovie(_root['image'],"bg") at the first frame of the FLA file and when I play it, I get a (Error opening URL "file:///C|/Documents%20and%20Settings/Desktop/undefined") message. The image that is supposed to replace the "bg" movieclip is just blank.
Reply With Quote
  #8 (permalink)  
Old Jul 25th, 2005, 17:26
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
what value do you have for 'image' ? is it just the image file name, or is it (as in one of your previous posts) the full html code to display image? it shud just be the filename & path...
Reply With Quote
  #9 (permalink)  
Old Jul 25th, 2005, 17:31
Junior Member
Join Date: Jul 2005
Location: Toronto, Ontario. Canada
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by benbacardi
what value do you have for 'image' ? is it just the image file name, or is it (as in one of your previous posts) the full html code to display image? it shud just be the filename & path...
the 'image' is the variable I placed in the html - <param name="Flashvars" value="&amp;title=Web Design&amp;image=[img]promotion.jpg[/img]">

If I just place the filename and path, doesnt that mean I wont be able to declare the variable in html and have to resort to using many swf files? Thanks.
Reply With Quote
  #10 (permalink)  
Old Jul 25th, 2005, 17:33
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
you are trying to load this image into a movieclip inside your movie, right? in that case, you should not include the <img> tags when you declare in your flashvars which image you wish to load... it shud just be

Code: Select all
<param name="Flashvars" value="&amp;title=Web Design&amp;image=promotion.jpg">
Reply With Quote
  #11 (permalink)  
Old Jul 25th, 2005, 17:37
Junior Member
Join Date: Jul 2005
Location: Toronto, Ontario. Canada
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by benbacardi
you are trying to load this image into a movieclip inside your movie, right? in that case, you should not include the <img> tags when you declare in your flashvars which image you wish to load... it shud just be

Code: Select all
<param name="Flashvars" value="&amp;title=Web Design&amp;image=promotion.jpg">
Thank you, I will try that, however what about the error I still get within the flash file where it wont let me declare the var that links to html?

EDIT: Never mind, I still get the error in my FLA file, but when I run the swf through my browser, it is working! Weird, but if its working, I'm happy! Thank you benbarcadi and Sirkent for your great help.
Reply With Quote
  #12 (permalink)  
Old Jul 25th, 2005, 20:28
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
Glad to help 8)
Reply With Quote
  #13 (permalink)  
Old Jul 25th, 2005, 21:14
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
No problem! (unusual for me to be able to help with anything to do with Flash tho!)
Reply With Quote
Reply

Tags
actionscript, linking, html, parameters, done

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking to an html page rusty149 Web Page Design 1 Feb 4th, 2008 10:34
movement parameters..... ARGH callumazoo Flash & Multimedia Forum 6 May 31st, 2007 14:19
Function parameters that include quotes loorp JavaScript Forum 7 Sep 17th, 2006 04:18
Linking pics with actionscript kevinrhart Flash & Multimedia Forum 7 Dec 31st, 2005 14:40
jump to marker using parameters Smokie Flash & Multimedia Forum 5 Jan 14th, 2005 08:39


All times are GMT. The time now is 01:35.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43