stageWebView in TouchSprite (2 posts)

Topic tags: stageWebView
  • Profile picture of Jeremy Moore Jeremy Moore said 11 months ago:

    I am attempting to render an HTML page in a TouchSprite using stageWebView. The issue I am running into is that stageWebView is not a display type and therefore can not be added as a child to a display component.

    Example code:

    package view
    {

    import com.gestureworks.core.GestureWorks;
    import com.gestureworks.core.TouchSprite;
    import com.gestureworks.events.GWGestureEvent;
    import com.modestmaps.Map;
    import com.modestmaps.events.MapEvent;

    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.DisplayObject;
    import flash.display.Loader;
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.display.Stage;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    import flash.events.EventDispatcher;
    import flash.geom.Rectangle;
    import flash.media.StageWebView;
    import flash.net.URLLoader;
    import flash.net.URLRequest;

    public class webView extends TouchSprite
    {

    private var urlAddress:String = “http://google.com”;

    public var stageWebView:StageWebView = new StageWebView();

    private var ts:TouchSprite;

    public function webView()
    {
    super();
    init();

    }

    private function init():void
    {

    ts = new TouchSprite();
    ts.width = 500;
    ts.height = 500;
    ts.x = 200;
    ts.y = 100;
    ts.rotation = 45;
    ts.scaleX = 0.5;
    ts.scaleY = 0.5;

    ts.gestureEvents = true;
    ts.disableAffineTransform = false;
    ts.gestureList = { “n-drag”:true, “n-scale”:true, “n-rotate”:true };
    ts.addEventListener(GWGestureEvent.DRAG, gestureDragHandler);
    ts.addEventListener(GWGestureEvent.ROTATE, gestureRotateHandler);
    ts.addEventListener(GWGestureEvent.SCALE, gestureScaleHandler);

    if(StageWebView.isSupported == true)
    {

    stageWebView.stage = this.stage;
    stageWebView.viewPort = new Rectangle(0,0, 500, 500);
    //stageWebView.addEventListener(LocationChangeEvent.LOCATION_CHANGE, locationChangedHandler);
    //stage.scaleMode = StageScaleMode.EXACT_FIT;
    //this.stage.addEventListener(Event.RESIZE, resizeEvent);

    getURL();
    }
    else
    {
    urlAddress = “StageWebView not supported”;
    }
    ts.addChild(stageWebView as DisplayObject);
    addChild(ts);
    }

    protected function getURL():void
    {
    stageWebView.loadURL(urlAddress);

    //stageWebView.addEventListener(Event.COMPLETE,handleLoad);

    }

  • Profile picture of Charles Veasey Charles Veasey said 11 months ago:

    I don’t think this will work. What happens if you load a website that already has touch support?

  

This material is based upon work supported by the National Science Foundation under Grant Number #1010028 Division of Research on Learning in formal and informal settings. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation.


Open Exhibits was developed by Ideum, makers of GestureWorks. Open Exhibits SDK is free for non-commercial use.

Connect