Hi,
Like Kenneth said - you need to pass all your navigation from Flash
through SWFAddress and don't directly create windows when someone clicks
a button in Flash, but you listen for the changes to the SWFAddress
value and open windows based on the value. That way, when someone
clicks the forward & back buttons in the browser, the history changes
the SWFAddress value, so your Flash will keep up...
//Somewhere in your init, you listen for changes to SWFAddress
SWFAddress.addEventListener(SWFAddressEvent.CHANGE, _changeHandler);
//Do your "normal" setup for buttons.
this.contact.addEventListener(MouseEvent.CLICK, newClick);
var internal:Boolean = false;
function newClick(e:MouseEvent):void{
//here is the swfAddress//
//You only set the value in here - you wait for SWFAddress to tell
you something has changed before doing anything
swfAddress.setValue(e.currentTarget.name);
//You might want to set a variable here like "internal = true" if
you want to know whether clicks are from inside Flash or from the browser..
internal = true;
}
//Handle changes in
function _changeHandler(event:SWFAddressEvent):void {
var newWindow:NewWindow = new NewWindow();
//The path value of the event contains the new SWFAddress path in
your history.
//On first load of the page you will get "/" as the path so you need
to handle this.
var path:String = event.path;
if("/" == path) {
path = "/home";
}
//Maybe do something if your internal variable was true.
if(true == internal) {
//Do something different maybe if someone clicked in Flash?
}
//reset internal
internal = false;
newWindow.name= path;
//...
}
HTH
Glen
Gustavo Duenas LRS wrote:
Hi Friends.
I have seen the tutorial for the swfaddress in gotoandlearn.com, but I
want to use it on a project I have which is a quite different situation,
1. the website is dynamic the parts of it are me on runtime, are not
present on the stage at the moment, are just called and assembly
depending of the name of the button that click the call.
2. the swfaddress works good when it comes to show the address in the
address bar of the browser, but when I try to use the directional
arrows of the browser I'm shooting at the dark totally.
Because I don't know how to make it work, since he tutorial never
mention about this particular.
here is the code to create the different parts.
//the part of the import the swfAddress is here, no problem at all
//the part of the set value//
switch(e.value){
case "/contact"
//here I don't know how to going forward since all my past intents
were so frustrating...any ideas?//
}
this.contact.addEventListener(MouseEvent.CLICK, newClick);
function newClick(e:MouseEvent):void{
//here is the swfAddress//
swfAddress.setValue(e.currentTarget.name);
var newWindow:NewWindow = new NewWindow();
newWindow.name=e.currentTarget.name;
an so on the structures that are in the windows
///the part of the addchild that works good//
}
I hope someone could help me...any advice welcome.
Gustavo
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
--
Glen Pike
01326 218440
www.glenpike.co.uk <http://www.glenpike.co.uk>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders