marquez20 / stagewebviewbridge

Automatically exported from code.google.com/p/stagewebviewbridge
0 stars 0 forks source link

stagewebviewbridge in uicomponent disappeared after tab change in TabbedViewNavigatorApplication #34

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Component: 

<?xml version="1.0" encoding="utf-8"?>
<mx:UIComponent xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:s="library://ns.adobe.com/flex/spark"
                xmlns:mx="library://ns.adobe.com/flex/mx"
                width="82" height="92" addedToStage="Init()">
    <fx:Script>
        <![CDATA[
            import es.xperiments.media.StageWebViewBridge;
            import es.xperiments.media.StageWebViewBridgeEvent;
            import es.xperiments.media.StageWebViewDisk;
            import es.xperiments.media.StageWebviewDiskEvent;

            import mx.core.FlexGlobals;

            private var browser:StageWebViewBridge;
            private var codigo_str:String;

            protected function Init():void{
                StageWebViewDisk.setDebugMode(false);
                StageWebViewDisk.addEventListener(StageWebviewDiskEvent.START_DISK_PARSING, onDiskCacheStart);
                StageWebViewDisk.addEventListener(StageWebviewDiskEvent.END_DISK_PARSING, onDiskCacheEnd);
                StageWebViewDisk.initialize(this.stage);
                browser.addEventListener(StageWebViewBridgeEvent.DOM_LOADED, end);

                //stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE,alRotarDispositivo);
            }

            protected function end( e:StageWebViewBridgeEvent ):void{
                this.dispatchEvent(new DataEvent('mapLoaded', true, false, 'ok'));
            }
            protected function onDiskCacheStart( e:StageWebviewDiskEvent ):void{

            }

            protected function onDiskCacheEnd( e:StageWebviewDiskEvent):void{

                var html_file:File = File.applicationDirectory.resolvePath("assets/map.html");
                var stream_fs:FileStream = new FileStream();

                stream_fs.open(html_file,FileMode.READ);
                codigo_str = stream_fs.readUTFBytes(stream_fs.bytesAvailable);
                stream_fs.close();

                browser = new StageWebViewBridge(this.x,this.y,this.width,this.height);

                browser.loadString(codigo_str);
                //browser.loadLocalURL("applink:/map.html");
                this.addChild(browser);

            }

            public function marker_s(lat:Number, lng:Number):void{
                browser.call('s_markit', null, lat, lng);
            }
            public function marker_e(lat:Number, lng:Number):void{
                browser.call('e_markit', null, lat, lng);
            }
            public function marker_taxi(lat:Number, lng:Number):void{
                browser.call('markit', null, lat, lng);
            }
            public function set_marker_t(lat:Number, lng:Number):void{
                browser.call('set_marker_t', null, lat, lng);
            }
            public function marker_freeze():void{
                browser.call('marker_freeze', null, null);
            }
            public function do_dir(path:String):void{

                browser.call('do_dir', null, path);
            }
            public function remove_all():void{

                browser.call('deleteOverlays', null, null);
            }
            public function do_focus(lat:Number, lng:Number, zoom:Number):void{

                browser.call('infocus', null, lat, lng, zoom);
            }
            public function get_markers():void{
                browser.call('get_markers', recieve_markers, null)
            }
            public function recieve_markers(str:String):void{
                var marks_arr:Array = str.split(';');
                if(marks_arr.length == 1){
                    var s_mark_arr_1:Array = marks_arr[0].toString().split('/');
                    FlexGlobals.topLevelApplication.spoint_lat = s_mark_arr_1[0];
                    FlexGlobals.topLevelApplication.spoint_lng = s_mark_arr_1[1];
                }else if(marks_arr.length == 2){
                    var s_mark_arr:Array = marks_arr[0].toString().split('/');
                    var e_mark_arr:Array = marks_arr[1].toString().split('/');
                    FlexGlobals.topLevelApplication.spoint_lat = s_mark_arr[0];
                    FlexGlobals.topLevelApplication.spoint_lng= s_mark_arr[1];
                    FlexGlobals.topLevelApplication.epoint_lat = e_mark_arr[0];
                    FlexGlobals.topLevelApplication.epoint_lng = e_mark_arr[1];
                }

                this.dispatchEvent(new DataEvent('getMarkers', true, false, 'ok'));

            }
        ]]>
    </fx:Script>
    <fx:Declarations>
    </fx:Declarations>

</mx:UIComponent>

I have added this component in view1

All things works ok

I click to view2

Then return to view1

html page has disappeared.

What version of the product are you using? On what operating system?

Adobe Flash builder 4.6

Original issue reported on code.google.com by pr.sara...@gmail.com on 7 Nov 2012 at 1:16