I want to do my stuff on LocationChangeEvent.LOCATION_CHANGE event which is introduced in AIR 2.7 but this event is not getting dispatched.My sample code is below. Please help me know if there is anything wrong that I am doing.
protected function button1_clickHandler(event:MouseEvent):void {
this.page.location = "http://www.google.co.in";
}
protected function locationChanging(event:LocationChangeEvent):void {
trace("location Changing");
}
protected function page_creationCompleteHandler(event:FlexEvent):void {
this.page.htmlLoader.addEventListener(LocationChangeEvent.LOCATION_CHANGING, locati开发者_如何学编程onChanging, false, 10, false);
}
<mx:HTML id="page" width="100%" height="100%" creationComplete="page_creationCompleteHandler(event)"/>
I have figured out why locationChanging event was not dispatching. I did few things to make it work.
- I upgraded my flex sdk from Flex 4.1 to Flex 4.5
- Added compiler option -swf-version=12
- Overlayed AIR 2.7 sdk over Flex 4.5 sdk
精彩评论