| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Feb 2005
Posts: 2
|
I need a little help on how to change the background of an HTML page containing a flash movie...from a button inside the flash movie...thanks in advance
|
|
|
|
|
|
#2 |
|
Super Moderator
Join Date: Jul 2001
Location: NYC
Posts: 10,026
|
You can create a JavaScript function to change the background of the HTML page containing the flash movie. From within flash, you can call that JavaScript function with getURL("Javascript:FunctionName(); )
__________________
Color Wars™ | (kul′ər wôrs) n. - Open conflict between factions. www.theColorWars.com cota - www.chadworkman.com | http://shavedplatypus.com occupation: designer | flash developer | server-side developer (php, asp, mssql, mysql) |
|
|
|
|
|
|
|
|
#3 |
|
it's all about patience
Join Date: Jun 2005
Location: istanbul
Posts: 5,859
|
I have been looking for this feature last 3 days with many methods of research in the Net. So here it is, working great:
ActionScript Code:
|
|
|
|
|
|
#4 |
|
it's all about patience
Join Date: Jun 2005
Location: istanbul
Posts: 5,859
|
Sorry, the one i wrote was for changing background image. The right code for the button (only the button, no scripting elsewhere) is:
ActionScript Code:
http://www.aliinhan.com/sources/JScodes.html Last edited by inhan; 08-14-2005 at 05:53 PM.. |
|
|
|
|
|
#5 |
|
Registered User
Join Date: Aug 2005
Posts: 1
|
Perfect and simple script Thanks inhan, its was helpfull for me too ! Cheers |
|
|
|
|
|
#6 |
|
it's all about patience
Join Date: Jun 2005
Location: istanbul
Posts: 5,859
|
anytime
![]() |
|
|
|
|
|
#7 |
|
Registered User
Join Date: Feb 2007
Posts: 3
|
Changing the bg Image of my HTML via Flash is exactly what I want to do! Thank you for providing this script!
I've included the script provided by Inhan...but I'm not getting the expected results. Please forgive me, but I am not experienced with javascript. Do i need to put a javascript function in my HTML for this to work? |
|
|
|
|
|
#8 |
|
Super Moderator
Join Date: Jan 2002
Location: Centreville, VA
Posts: 24,878
|
How about this page??? Don't know about changing the background image, but you should be able to use the similar approach to do so...
![]() http://tutorials.flashvacuum.com/ind...ckground_Color
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer http://CyanBlue.FlashVacuum.com http://www.FlashVacuum.com http://tutorials.FlashVacuum.com Do NOT PM, Email or Call me... Your question belongs right in this forum...
|
|
|
|
|
|
#9 |
|
Registered User
Join Date: Feb 2007
Posts: 3
|
what would I change in this function to make it change the background image instead of the color?
function changeBgColor(newBgColor) { if (window.document && window.document.bgColor) { document.bgColor = newBgColor; } } Thank you!!! |
|
|
|
|
|
#10 |
|
it's all about patience
Join Date: Jun 2005
Location: istanbul
Posts: 5,859
|
I'm not sure if it would work on PC's too, but I modified the code and it works with Mac FF & Safari. If you want the image not to repeat, you have to add something to the code (with which I am not familiar).
In the html file, in the "head" section: HTML Code:
<script language="JavaScript"> <!-- function changeBgImg(newBgImg) { //alert('new image is = ' + newBgImg); document.body.background = newBgImg } --> </script> ActionScript Code:
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|