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.
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/ -
Next and Previous slide from Flash Menu
We are currently tasked with updating SAP training that was
created with OnDemand software. The current simulations have a
Javascript menu on each screen which provides various functions
including moving from current slide to next or previous slides.
When the existing movie is played and captured, we lose the
javascript menu functionality.
I have created a Flash Menu and have imported it to the newly
captured Captivate movie. All links on the menu work except Next
Slide and Previous slide.
The script I use for the button for the Next slide is as
follows:
this.next_btn.onRelease =function(){
this._parent._parent..nextFrame();
Also I have tried substituting for nextFrame "play" and for
the target path "_root" for the first "_parent."
The variables "rdcmndNextFrame" and "rdcmndPrevious" do not
work unless you are using a playback bar, which detracts from the
simulation.
Has anyone ever created this type of functionality? It seems
that it would be straight forward. It is most likely a target path
issue. The captivate movie is the container for the flash menu. To
access the captivate movie timeline and move to the next or
previous slide is what I really need.
Help!I resolved the issue by selecting to use a playback bar and
then in the Flash file setting the visibility of the playback bar
to "0". -
hi,
i had flash menu which i had put in iframe as i wanted to have fixed page size and menu items were long ,so i made product html page in which there is flash menu,then i call product html page in <iframe> in main page but event not working,i guess its something releated to target but i am not getting it.
Any help will be appreciate.Sending you copy of demo side.what i want to do is..
.when menu is clicked that page should loaded and the menu item is highlighted in menu which is in iframe.it used to work properly when i remove iframe but then the product list is long and i want to present in fixed webpage without scoller for which i am using iframe.if you have anyother idea for presenting scroller in flash please let me know. -
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 -
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!!! -
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 -
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
HenriYes 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. -
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") -
I have a link on a page that takes you to a particular spot
on another page-in other words the link is anchored. It takes you
to a section of the page that has a flash movie. Simple enough.
However, this flash movie has a preloader in it and whenever
I click the link the preloader won't work properly, if at all. I
was assuming it was my actionscript or how I created the movie but
I've tested this thing inside out and had no problems until I
uploaded it.
Then I noticed something: since the link is anchored I
decided to navigate to the page without the anchor (i.e. take off
the #anchor section of the web address) and wouldn't you know it,
the preloader works like a charm.
The questions are this: how could a simple anchored page
affect a swf? Is it possible that the anchor is forcing the page to
skip some of the flash embedding code when parsing? Has anyone even
heard of this and if so, have you heard of any solutions?
If you'd like to view what I'm babbling about:
*page in question
here
*to test the page both ways remember to clear your cache
after the first view
Please note this issue is not dealing with creating anchors
within Flash using the "Flash with named anchor" feature when
publishing it in HTML. The anchor is completly seperate from the
movie.
Any help or insight to this problem would be appreciated!Still no luck finding any information on this topic.
Please let me know if you know of this and how to resolve
such a glitch.
Thanks -
Help Editing code from a published html file with flash detection enabled from flash
hi guys ive publish a html file with flash detection enabled from flash
heres the code from the publish html:
<!-- saved from url=(0013)about:internet -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>main</title>
<script language="javascript"> AC_FL_RunContent = 0; </script>
<script language="javascript"> DetectFlashVer = 0; </script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
<script language="JavaScript" type="text/javascript">
<!--
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Revision of Flash required
var requiredRevision = 45;
// -->
</script>
</head>
<body bgcolor="#ffffff">
<!--url's used in the movie-->
<!--text used in the movie-->
<script language="JavaScript" type="text/javascript">
<!--
if (AC_FL_RunContent == 0 || DetectFlashVer == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if(hasRightVersion) { // if we've detected an acceptable version
// embed the flash movie
AC_FL_RunContent(
'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0',
'width', '800',
'height', '600',
'src', 'main',
'quality', 'high',
'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
'align', 'middle',
'play', 'true',
'loop', 'true',
'scale', 'showall',
'wmode', 'window',
'devicefont', 'false',
'id', 'main',
'bgcolor', '#ffffff',
'name', 'main',
'menu', 'true',
'allowScriptAccess','sameDomain',
'allowFullScreen','false',
'movie', 'main',
'salign', ''
); //end AC code
} else { // flash is too old or we can't detect the plugin
var alternateContent = 'Alternate HTML content should be placed here.'
+ 'This content requires the Adobe Flash Player.'
+ '<a href=http://www.macromedia.com/go/getflash/>Get Flash</a>';
document.write(alternateContent); // insert non-flash content
// -->
</script>
<noscript>
// Provide alternate content for browsers that do not support scripting
// or for those that have scripting disabled.
Alternate HTML content should be placed here. This content requires the Adobe Flash Player.
<a href="http://www.macromedia.com/go/getflash/">Get Flash</a>
</noscript>
</body>
</html>
now since the default codes places my flash movie on upper left corner, ive made my own tables with the flash on it, how or where do i place this code to the upper codes?
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th valign="middle" scope="col"><table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th height="600" bgcolor="#333333" scope="col"><script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','wid th','800','height','600','src','main','quality','high','pluginspage','http://www.adobe.com /shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','main' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="800" height="600">
<param name="movie" value="main.swf">
<param name="quality" value="high">
<embed src="main.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="800" height="600"></embed>
</object></noscript></th>
</tr>
</table></th>
</tr>
<tr>
<td height="30" bgcolor="#990000"><table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th scope="col"><table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<th scope="col"><div align="left" class="style1">Copyright 2009 St. Paul of the Cross Parish. All Rights reserved.</div></th>
<th width="400" scope="col"><div align="right" class="style1">Usage outside our permissions guidelines requires our prior written consent.</div></th>
</tr>
</table></th>
</tr>
</table></td>
</tr>
</table>
Tnx in advance!Hi
Can you tell me which version of dreamweaver you are using (and flash pro, if you have it), as the code you provided has element of a number of different versions (e.g. your js flash files are reasonably new, but your flash inserted into the html body is old, but with the cs3 version of flash player indicated!). Also the detect flash file is no longer required.
PZ -
Flash Menu, HTML content and Z-index
I have a flash menu that needs to overlap HTML content. I have already done this by using a negative margin on the HTML content and setting the flash menu to transparent.
The problem is all the HTML links that are 'underneath' the Flash menu do not function. I tried changing the Z-index but that did not work because then the menu goes behind the text. Are there any other solutions?
Thanks."robot88888888" <[email protected]> wrote...
> You may want to look at this:
>
http://meyerweb.com/eric/css/edge/menus/demo.html
>
> You may want to stay away from pure CSS menus until
there is better
> browser support. Or if you prefer to use the menus you
have, you
> should consider making the top-level links go to a page
which allows
> vistors to click on your other links. For example, if
you click the
> Calendar option, it should bring you to a page which has
links to the
> Jan., Feb., etc. pages.
>
> Right now neither of your drop-down menu structures work
in IE6 for
> Windows...which I would assume is your primary audience.
Well, there's always a way to make so-called "pure" CSS menus
a bit
cleaner :-)
http://www.projectseven.com/tutorials/navigation/auto_hide/index.htm
Al Sparber
PVII
http://www.projectseven.com
"Designing with CSS is sometimes like barreling down a
crumbling
mountain road at 90 miles per hour secure in the knowledge
that repairs
are scheduled for next Tuesday". -
Hi I have a button in a flash movie that sits in a page
called costadelaluz.htm , I want the button to communicate to a
html anchor link in the same page but I cannot seem to make this
work
the code I have added is
on (release) {
getURL("costadelaluz.htm#medina", "self");
however this is not going to the anchor link in the html page
- can anyone helpÇ
Thnaksstacyp wrote:
> Hi I have a button in a flash movie that sits in a page
called costadelaluz.htm
> , I want the button to communicate to a html anchor link
in the same page but I
> cannot seem to make this work
> the code I have added is
> on (release) {
> getURL("costadelaluz.htm#medina", "self");
>
> }
html#anchor use to be very problematic few years back.
Browsers didn't like it and even tho
you made one browser like it, it would stop working in
another. We had all kind of work around,
from javascritp to url encoding. Perhaps give it a try and
see what works for you:
getURL("javascript:top.left.location.href='test.html#anchor';
void(0);");
Keep in mind , the functionality will vary based on browser
version also due to
new security settings, you might not be able test it locally,
might need to upload
to server.
If using URL encoding, replace the # with %23:
getURL ("some.html%23anchor");
Best Regards
Urami
!!!!!!! Merry Christmas !!!!!!!
<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
</urami>
Maybe you are looking for
-
i added a validator in the form when am running i got this error Mar 1, 2004 5:04:01 PM org.apache.commons.validator.ValidatorUtil getValueAsStri ng SEVERE: Unknown property 'username' java.lang.NoSuchMethodException: Unknown property 'username' at o
-
I have to switch bluetooth on and off to use bluetooth keyboard??
I'm using an iPad 3G 64GB with my Apple bluetooth keyboard. Everything works great, but one thing annoys me. If I'm using the bluetooth keyboard and then walk away from my desk and lay in bed with my ipad, I cant bring up the software keyboard withou
-
Curve/Level RGB Doesn't Change Individual Channels
Weird. When I adjust slider in Levels or point in Curves using the RGB master (default), and then go to the individual color channels, none of them have changed at all. Has anyone else seen this behavior?
-
I got an email with a XML doc and can't open it?
How or can i open an XML doc in an email. I downloaded it but can't get it open.
-
Adobe pdf pack monthly subscription not working
My adobe pdf pack monthly subscription has never worked. I can see 'Adobe createPDF desktop printer' as a printer option but when I click print I get the following message (for a split second) Printing..... now printing page 2 of Microsoft Office Out