Changind html background from Flash
Hello,
I have a centered Flash website(table align center), and I
would like to
have the html background to change on certain event.. Is
there a way to
do this without having to reload a new html?
Thanks
Henri
Yes that's what I understood; I was also wondering after
reading your
replies if if a getURL couldn't do the job f;i;:
on (release) {
getURL("javascript:document.body.background='new_bg_pic.jpg'");
what would be the disadvantage of this compared to
exterrnalinterface class?
kglad wrote:
> p.s. if you're using flash 8, use the externalinterface
class. the link j.e. gave is for the old fscommand which fails in
some browsers.
Similar Messages
-
Opening an HTML popup from Flash, not as tab
Hi
I need to open an HTML popup from Flash (using ActionScript in
Flex 4).
Thus far I found a solution, and it does work in Safari - a new
and separate HTML window is popped up (with a new web page).
private function popUpTheHtmlEditor():void {
var url:String = "http://www.adobe.com";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, '_blank');
} catch (e:Error) {
trace("Error occurred!");
But in (my) Firefox (with my settings), when I click on the Flash
(Flex) button, the page is being opened in a new tab.
I need a solution which pops up the HTML page in a new/separate
window, as far as possible regardless of the browser (and browser
settings).
I found an example where a popup is opened from HTML, and it opens a
separate window (a real popup) in my Firefox:
http://www.gtalbot.org/FirefoxSection/Popup/PopupAndFirefox.html
-> "Open a requested popup"
The JavaScript code seems to be:
OpenRequestedPopup(this.href, this.target); return false;
with this function def:
function OpenRequestedPopup(strUrl, strTarget)
if (WindowObjectReferenceOfRequestedPopup == null || WindowObjectReferenceOfRequestedPopup.closed)
WindowObjectReferenceOfRequestedPopup = window.open(strUrl, strTarget, "top=" + windowTop + ",left=" + windowLeft + ",width=" + windowWidth + ",height=" + windowHeight + ",menubar,toolbar,location,resizable,scrollbars,status");
else
if(WindowObjectReferenceOfRequestedPopup.focus)
WindowObjectReferenceOfRequestedPopup.focus();
How could I call such code from ActionScript? Should this work through
ExternalInterface? I couldn't even get this to work:
ExternalInterface.call('alert', 'foo');
Should I use swfobject.js for embedding the .swf in the HTML wrapper?
Any other ideas?
The two files are pasted below.
Here's the compiler command I'm using:
mxmlc -output button.swf -target-player 10.0.0 flash_to_editor.mxml
I'm running the examples locally (as files, not over http). Would it
help to place the files on a server?
Tobi
<?xml version="1.0" encoding="UTF-8"?>
<mx:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
horizontalAlign="center" verticalAlign="middle">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import flash.external.ExternalInterface;
import flash.net.URLRequest;
// This 'http://www.adobe.com' is just an example URL.
// Works but opens tab in FF (not a separate window):
private function popUpTheHtmlEditor():void {
var url:String = "http://www.adobe.com";
var request:URLRequest = new URLRequest(url);
try {
navigateToURL(request, '_blank');
} catch (e:Error) {
trace("Error occurred!");
// Doesn't work:
// var url:URLRequest = new URLRequest("javascript:alert('foo'); void(0);");
// navigateToURL(url, "_self");
// How to get this to work?
private function popUpTheHtmlEditor():void {
ExternalInterface.call('alert', 'foo');
// How to get this to work?
private function popUpTheHtmlEditor():void {
ExternalInterface.call('launch','http://www.adobe.com');
// Or
// ExternalInterface.call("window.open", "http://www.adobe.com", "win", "height=200,width=300,toolbar=no,scrollbars=yes");
// Perhaps it's necessary to try different approaches:
// (As soon as I get two approaches to work.)
private function popUpTheHtmlEditor():void {
var s:String;
if (ExternalInterface.available) {
// Necessary? Safe?:
// Security.allowDomain('*');
s = ExternalInterface.call('launch','http://www.adobe.com');
} else {
// TODO: Then try URLRequest?
s = "Wrapper not available";
Alert.show(s);
]]>
</fx:Script>
<s:Panel title="One way to open the HTML editor"
width="75%" height="75%">
<s:Button id="button" label="Open the HTML editor"
click="this.popUpTheHtmlEditor();"
horizontalCenter="0" verticalCenter="0"/>
</s:Panel>
</mx:Application>
<html
xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en" lang="en">
<head>
<title>html_around_swf.html</title>
<script type="text/javascript">
function launch(url) {
alert(url);
// OpenWin = this.open(url, "FOO", "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,width=400,height=200");
</script>
</head>
<body>
<object id="button" name="button" width="550" height="400"
classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">
<param name="movie" value="button.swf" />
<param name="allowScriptAccess" value="always" />
<embed id="foo" name="button" src="button.swf" width="550" height="400"></embed>
</object>
</body>
</html>Hi,
Here's a solution.
1. Make ExternalInterface work when files are loaded as local files:
Go to
http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.htm l
In tab Global Security Settings: Edit Locations -> Add Location ->
browse to the .swf file, add it. Make sure it's in the list (under the
Edit Locations drop down, with a green check mark.)
Now open the HTML wrapper in a browser (eg Firefox).
Now this works (ActionScript):
private function popUpTheHtmlEditor():void {
ExternalInterface.call('alert', 'foo');
On Windows: perhaps:
http://techjig.blogspot.com/2008/03/flash-global-security-settings-windows.html
"In order for external interface functions to be called, you must also
specify the folder/file where the swf file is located."
The above setup isn't necessary when the files are on a server.
Also see:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/External Interface.html#call()
""ExternalInterface" "
"call() method"
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7ea6.html
"About ExternalInterface API security in Flex"
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf626ae-7fe8.html#WS2d b454920e96a9e51e63e3d11c0bf69084-7f31
"Using the ExternalInterface API to access JavaScript"
2. Open a real popup: Example:
ActionScript:
private function popUpSomething():void {
var editorPathOrUrl:String =
'wrapper.html';
var windowName:String =
"SomeNameSeeDocs";
var windowFeatures:String =
"toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes,width=500,height=700";
ExternalInterface.call(
'launch',editorPathOrUrl,windowName,windowFeatures
JavaScript:
function launch(editorPathOrUrl,windowName,windowFeatures) {
windowRef = window.open(
editorPathOrUrl,windowName,windowFeatures
Works in all browser I tested except Opera.
Tobi -
How to Call HTML Layers from Flash?
how to Call HTML Layers from Flash? i need a help on example
or script.What do you mean html layers? You can call JavaScript on the
page using the
ExternalInterface class. There's examples in Help if you look
up the EI
class, and it's call method.
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
Navigate to HTML anchor from flash menu
Hi,
I would like to navigate to an html anchor from a flash menu.
I use navigateToURL(“#anchorName”,
“_self”). It work fine in IE 7, Firefox 2 and 3 but in
safari the page reload. How can I prevent safari from reloading the
page ?
Thank you !I have solved the problem by using the externalInterface and
a javascript function with window.location.hash. -
Trying to call MM_showHideLayers on container HTML page from Flash
I'm designing a site that is mostly in Flash, but I would
like to show some content by changing the visibility of a layer on
the HTML page that contains the swf file. I have tried
on (press)
{ExternalInterface.call("MM_showHideLayers",'testerbox','show');
and
on (press)
{ExternalInterface.call("MM_showHideLayers('testerbox','','show')");
and I have tried
on (press)
{getURL("javascript:MM_showHideLayers('testerbox','','show')");
My HTML page code is below. Can anyone tell me what I am
doing wrong and point me in the right direction? Can this be done?
Is there a better way to display large amounts of highly formatted,
dynamic content from within Flash without loading a new page or
resorting to a pop-up window? I really want it to look and feel
like it is all part of the same page, and I need more tags than I
can use in a Flash textbox. Thanks in advance :-)
Teri
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script type="text/javascript"
src="swfobject.js"></script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if
((obj=MM_findObj(args
))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style;
v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
//-->
</script>
<style type="text/css">
<!--
#testerbox {
position:absolute;
width:200px;
height:115px;
z-index:6;
left: 69px;
top: 42px;
background-color: #FFFFFF;
visibility: hidden;
-->
</style>
</head>
<body bgcolor="#FFFFFF">
<table width="316" height="180" align="left"
cellpadding="0" cellspacing="0">
<tr>
<td
background="../images/innerpage/sidebar-bg-iframe.jpg">
<div id="testerbox">My test</div>
<div id="flashcontent" align="center">
<p>
You must have Flash Player to use this feature.<br>
<br>
<a href="
http://www.macromedia.com/go/getflashplayer"
target="_blank">Click
here</a> to download or upgrade your Flash Player
</p>
</div>
<script type="text/javascript">
// <![CDATA[
var so = new
SWFObject("leaders.swf","leaders","316","180","6");
so.write("flashcontent");
// ]]>
</script>
</td>
</tr>
</table>
</body>
</html>
Text
Text
Text
TextHi, did you get a solution to this problem, i am having a similar issue with the MM_showhidelayers not working in IE6, it works fine in IE8?
the code im using on a flash button is:
on (press) {
import flash.external.ExternalInterface;
ExternalInterface.call("MM_showHideLayers('menu','','show','menu_back','','show' )");
Thanks
Gary -
HTML background matching flash background
Hey, I have a flash website that opens as a pop up, the pop
auto fullscreens. The background in the flash document is a
gradient, and I have a gradient in the background of the html. My
question is how would I get the background of the HTML to always
match up with the flash background using a percentage?
www.flippingsweet.net/index2.htmlYes that's what I understood; I was also wondering after
reading your
replies if if a getURL couldn't do the job f;i;:
on (release) {
getURL("javascript:document.body.background='new_bg_pic.jpg'");
what would be the disadvantage of this compared to
exterrnalinterface class?
kglad wrote:
> p.s. if you're using flash 8, use the externalinterface
class. the link j.e. gave is for the old fscommand which fails in
some browsers. -
I created a flash file that contains a flv file inside. After I published it on my Mac in both html and swf format and it played well. But when I copied all this folder include the swf, html and the source flv to test on a pc it played well but the video part (flv) was blank. So I copied the .fla file to pc and published again, then it works fine (including the flv video part) on both pc and Mac. All the settings were same while publishing.
So I wonder what's wrong with publish from Mac side? I work with Mac and so it's very inconvenient to publish my work on PC.Hi kglad,
Here's the link: http://ben-wang-van.bugs3.com/test.html
This is the simple test. As you can see the video part (after the text) is empty and the flv file is actually the same location.
From last experience, if I pubulish this video from PC and upload them and then will play fine.
Any idea?
Thanks a lot!!! -
Flash background from flash pro to dreamweaver.
I know quite well dreamweaver but i dont know flash.Is there any way so i can make background moving in my site like this(i meen the character with the helmet and the background house not all the site):
http://eu.blizzard.com/diablo3/index.xml
a tutorial or something plzYou can't get html over flash you have to create a full flash website to get that effect or ...
make an animated .gif file in photoshop and set it as the background in DreamWeaver.
Google this for further info!
Make an animation for your 'moving background' and add your content over it -
How to fade html background behind flash?
I was wondering if someone knows of a tutorial or an easy to follow example of flash being popped up over an html page and the background of the page fade to a slightly darker colour so that the flash is more prominent.
I've seen it done and would like to know how its done. An example of what i'm speaking of is here:
http://www.tcpipelineslp.com/
(click on the map)Looks too complicated. It sounds like using this method to fill the browser window would scale my swf to fill the screen when all i want is to keep my project the size i built it at but scale the background.
-
Problem open new html page from flash
Hello,
in IE7 and IE8 block popup lock my external link(page html)
I use GetUrl(url,"_blank") but not it works
Why?
i use flash cs4
With firefox it workthank you for response,
i have used correct command but not it works.
It Works, in my popup setting are setting "CUSTOM" not MEDIUM
thank you -
Implementing osmf HTMLMediaContainer into HTML page from Flash Proffessional
Integrating communication between osmf and javascript via HTMLMediaContainer using Flash Proffessional
Quite new to this
Hello may someone please explain how this is done exactly, Not quite understanting the samples and examples, I get the onHTMLMediaContainerConstructed function but after that, Im quite lost on the javascript inside the HTML body tags!! is this body tag javascript needed if im using flash professional...please help
Thanks evryoneHi GeekTumiso,
i'm searching for documentation too ... i want to understand if i can load external html element to make an html player skin, but there is not documentation or good example :-(
any suggestions? -
Interacting with html documents from flash
Hi,
I'm a newbie in actionscript. I created a world map in flash. The map has regions (Europe, North America, Latin America, etc.). The regions on the map are defined as buttons.
The final flash map will be embedded in an html document (map.html). The idea is that when you click for example the "Europe" button on the flash movie, this will open an html document called Europe.html and will show it underneath the map flash (inside map.html).
The "Europe.html" for example contains a list of countries.
In this mission I have 2 problems:
1. What script I have to attach to every region button on the flash map so it will call the right html file into the div on the map.html?
2. What script do I have to put inside the html document?
Any help will be much appreciated. thank you
Arie M.assign your button an instance name (in the properties panel after selecting your button) and use that name in the actions panel:
yourbutton.addEventListener(MouseEvent.CLICK,f);
function f(e:MouseEvent):void{
navigateToURL(new URLRequest("map.html"),"youriframe") -
Audio from flash sources are still playing in the background after their sources have been closed; audio also starts playing when I start the browser. Closing plugin-container.exe in task manager solves this, but I do not want to do this every time I have audio in the background that should not be there. Not a good move to launch a browser where the kinks haven't been worked out. Have tried to inactivate addons etc. This problem is related to FF5, but have also happened earlier, with FF4. Solved that time by moving to Chrome instead.
Sounds that the plugin-container process isn't closing properly.<br />
See http://kb.mozillazine.org/Plugin-container_and_out-of-process_plugins
There are other things that need attention.<br />
You have a corrupted Firefox 3.6.13 user agent: Firefox/2.0.0.14;MEGAUPLOAD 1.0
See:
* [[Web sites or add-ons incorrectly report incompatible browser]]
* http://kb.mozillazine.org/Resetting_your_useragent_string_to_its_compiled-in_default -
How to pass text from flash to html?
how to pass text from flash to html?
This is a wonderful sample i found online.
pls run using a server so that it can display properly
http://active.tutsplus.com/tutorials/actionscript/flash-html-javascript-externalinterface/ -
Loading Image from HTML page into Flash component
Ok, after doing much research on the internet, I am pretty
sure you have to be a Flash and Actionscripting Jedi in order to
solve this issue. Here we go:
I have created an HTML page using PHP and MySql that displays
image thumbnails. When a user chooses and clicks on one of the
thumbnails, I want the larger image to be loaded into my swf. It is
a jigsaw puzzle component I picked up here: www.crifano.com. Here
is the puzzle on my page with an image manually inserted using
Flash 8 (Note: This is only working in Internet Explorer right now,
for whatever reason):
http://premieretans.com/puzzle/jigsaw.php.
I want the image on this page to be chosen by the user from a
number of images that are populated on a regular PHP/HTML page from
a MySql database. What is the best way to go about this?
Thanks so much for the help on this matter. I know I am not
the only person who has run into this dilemma, so I hope your
knowledge will save others with a similar problem the hours I have
spent on this issue myself. Thank you!
Cheers-
CharlesHi,
There's no direct support for this. But you could implement
drag and drop the way you normally would in javascript. Except
here, on mouseUp over a div encapsulating the object or embed tag
(the flash object), you'll need to make a call into actionscript
from javascript indicating that a drag and drop happened.
For more info, see
how
to drag and drop using javascript and
actionscript
and javascript communication
Maybe you are looking for
-
How do I remove the grid map over an object when working in 3D?
I am working through Adobe's Photoshop CS6 Classroom in a Book, Section 12 - Working with 3D Images. So far I have found it all fairly straight forward and very useful. I am at a point where I am applying textures and materials to my objects, however
-
Logical Database - PNPCE - Hide 'Org Structure' 'Search Help' etc buttons
Hi, We have created a report by making a z copy of RCATS_APPROVE_ACTIVITIES. In the Z version we need to hide the buttons on the titlebar of the selection screen. Buttons are - Org Structure - Search Help - Dynamic Selection - Selection Fields. Can y
-
Hi team, We have an issue where we want to change the Requestor for PO in SRM as the requestor is leaving the organization. Do we have any way possible to change the Requestor for SRM PO? Regards, Lovkesh
-
Please suggest me the best way to start learning about Oracle Purchasing.
Hi, I have started reading about Oracle Procurement. I have an over all idea of how ERP functions. Anyhow I am like a fresher to ORACLE APPS. Can you pleasesuggest me what is the best way to start learning about Oracle Purchasing. Is it is throuhg us
-
HD video Fonts. Crisp clean cut lines. No pixelation
Hello People! I'm hoping someone can help me figure my little problem out. I just got an internship at this media company and they are demanding. They want videos with CRISP FONT TEXTS that are more appealing to the public. The problem here is that I