Hey People

I have a flash question which is probably pretty simple but it is driving me mad!

I cant remember how to jump to a .htm file through a flash button when the .htm file I want to get to is in a different folder???

I have the file index.htm right under my htdocs folder on the web which has a swf file in it. I have a folder called ‘Video’ under the htdocs folder with a file in that called video1.htm.

When i click on the button in the swf file which is in index.htm, i want it to take me through to video1.htm which is in the folder 'Video'. If that makes sense!!

My actionscript reads;

on(release){
            getURL("Video/video1.htm");
}

How come it isn’t working?? Just sends me to a page that says ‘page cannot be displayed’!!!

Thanks for any help

GR Web FX

Dani AI

Generated

Quick summary for : the behaviour you saw comes down to how Flash resolves relative URLs. In most browsers getURL() resolves a relative path relative to the HTML page that embeds the SWF, not necessarily the SWF file’s folder — older players/browsers had exceptions, which is why different answers here conflicted. (ActionScript reference). (docstore.mik.ua)

Practical fixes (ordered from simplest to most robust). First, use a site-root absolute or full URL when possible so there’s no ambiguity. If you need the SWF to resolve links from a particular folder, set the HTML/object/embed BASE parameter or pass a base path into the SWF (flashvars) so ActionScript can build a full URL; the BASE param is the usual HTML-side fix. (Flash/BASE notes). (flylib.com) If you prefer to compute inside the movie (AS2), determine the SWF’s URL at runtime and prepend it before link targets, for example:

/* AS2 example - compute SWF folder and open a page relative to it */
var basePath = this._url.substring(0, this._url.lastIndexOf("/") + 1);
myButton.onRelease = function() {
    getURL(basePath + "video1.htm");
};

Also check embedding parameters: a misspelled or overly-restrictive allowScriptAccess (e.g., set to never) can block script/browser interactions, so use the correct name and an appropriate value (sameDomain/always) when you need cross-window/script calls. (open-flash.github.io) Finally, note that testing via file:// can behave differently; try a real web server (upload to your host or run a local server like http://localhost) — many “dead click” cases go away when served over HTTP. (community.adobe.com)

One last, important note for anyone reading this years later: Adobe retired Flash Player on December 31, 2020 and browsers now block Flash by default. For new work, convert interactions to HTML5/JS (or use an emulator like Ruffle) instead of relying on SWF-based navigation. (Adobe Flash EOL info). (adobe.com)

Recommended Answers

All 9 Replies

Where is your swf file placed? Use getUrl path relative to swf file.

Member Avatar for Member #114696

yeah every link link in flash is relative to the swf file directory

Hi

if still facing the problem so,

just add "/" in the file path

now AS should looks like:

actionscript reads;

on(release){
getURL("/Video/video1.htm");
}

this will work for you ;)

thanks
Rahul

i'm using actionscript 2.0 and i have linked my flash to another page using the following code:

submit_btn.onRelease = function (){
if (password_txt.text == myPassword) {
gotoAndStop(9);
getURL(" "_self",);

and when i test it, it will run fine but when i embed in my webpage using strict XHTML compliant code it wont open the new page, can anyone tell me why and how to fix it? Any help would be greatly appriciated. The code i used to embed the movie is:

<p>
<object type="application/x-shockwave-flash"
data="site.swf?path=site.swf"
width="900" height="650">
<param name="movie"
value="site.swf?path=site.swf" />
<param name="allowScriptAcess" value="never" />
<img src="noflash.gif"
width="200" height="100" alt="" />
</object>
</p>

getURL(" "_self",);

and when i test it, it will run fine but when i embed in my webpage using strict XHTML compliant code it wont open the new page, can anyone tell me why and how to fix it? Any help would be greatly appriciated. The code i used to embed the movie is:

try this getURL(" "_blank",);

_self = this will open in same window

_blank = this will open in new window

try this getURL(" "_blank",);

_self = this will open in same window

_blank = this will open in new window

Yeah i'm fairly competent in html and that was one of my first thoughts but still nothing happens. I have even tried just having text in the flash movie to link but it wont either???

I am also having the same problem. I have built some animated buttons and put the correct actionscript inside them but the links won't work. Nothing happens, just a dead click on the button. Its really strange? It works when testing the movie in flash 8, but not when i publish it to a webpage?

desperately need some help

Oli

i found that it was becuase i was testing it out locally, try uploading it to your server then see if it's still a dead click.

IT WORKS!!!!! thats awesome thanks so much!!!!!

oli

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.