AS 1.0 deeplinking by cobo from DQS
[ 2006-02-11 11:01:29 | Author: liuhuan ]
Quote
There was a question in the flash section how to realize fake-deeplinking within flash as seen on http://www.acura.com. This is Flash MX AS 1.0 / php based tutorial and should only show the idea behind the whole thing. There's not much time spend with site setup
Set up your site as usual. You will have a couple of buttons (navigation) which will cause your site to load sub sections. All we have to do now is to cause this action from "outside" of flash.
For this reason we will attach a variable to our existing URL and load it into flash to initiate our load actions.
STEP 1
Open your main .fla and add a dynamic textfield to your stage. call it "deeplink". this will show your user the deeplink, so make sure to make it markable.
set up an empty mc dynamicly or manualy and call it "holder_mc". this is where our subsections will be loaded.
STEP 2
add the following code to your main timeline.
Code:
updateSite(); // call function at the beginning
// update site with your deeplink
function updateSite() {
// check if a deeplink was received
if (_root["initPath"] == "portfolio" || _root["initPath"] == "about") {
_root.targetLink = _root["initPath"];
loadSubsection();
}else{
_root.deeplink = "you're at home";
}
}
function loadSubsection() {
// _root.targetLink holds information from your button what to load
_root.holder_mc.loadMovie(_root.targetLink + ".swf");
// write your deeplink
_root.deeplink = "http://www.yoursite.com/index.php?initPath=" + _root.targetLink;
}
we are calling our deeplink with _root["initPath"];
afterwards we call a function to load our subsection - it's the same function which is called if a button gets pressed thats all...
we fill the deeplink textfield with our URL and add only the actual section.
STEP 3
create yourself some nice buttons and add the following code to them:
Code:
on(release) {
_root.targetLink = "portfolio"; //write "about" on the other button
loadSubsection();
}
last but not least we have to modify our index.html
change it's name to index.php and change this line inside your object tag
Code:
<PARAM NAME=movie VALUE="index.swf">
to
Code:
<PARAM NAME=movie VALUE="index.swf?initPath=<? echo $_GET["initPath"]; ?>">
this is where the variable is passed into flash.
feel free to ask if something is unclear
as far as i know flash 8 comes with a prebuild deeplink function, but for all other users this will help...
attached a simple setup.
cobo
Comments Feed: http://www.liuhuan.com/blog/feed.asp?q=comment&id=496
View Mode: Show All |
Comments: 1 |
Trackbacks: 10 | Toggle Order | Views: 2391
liuhuan
[ 2006-02-11 11:00:44 ]
http://forum.24-7media.de/viewtopic.php?t=5289
You can't post comment on this article.