0
votes

I'm trying to build an App for iOS using Flash Pro CS5.5, I need to implement a simple video on one of my pages and I'm having trouble controlling it. After a few hours of googling I finally managed to get a video working and running without hitches onto the page but I still can't get my head around a few things:

  • How can I prevent it from auto playing? I see no options or vars that I can change to prevent it from playing as soon as the app is loaded up
  • Is it possible to nest stageWebView within a MovieClip? Right now it just loads right on top of everything, is it possible to have it move/scale/fade/etc. I imagine it would be something to do with where I set the stage or viewPort but I can't figure it out.

The following is my code:

import flash.geom.Rectangle;
import flash.media.StageWebView;
import flash.filesystem.File;


var webView:StageWebView = new StageWebView();
var path:String = new File(new File("app:/video.mp4").nativePath).url;

videoBtn.addEventListener(MouseEvent.CLICK,videoOpen);
videoBtn.buttonMode = true;
videoBtn.alpha = 0;

function videoOpen(event:Event = null):void{
    webView.stage = this.stage;
    webView.viewPort = new Rectangle(100, 100, 600, 480);
    webView.loadURL(path);
}


videoBtnStop.addEventListener(MouseEvent.CLICK,videoClose);
videoBtnStop.buttonMode = true;
videoBtnStop.alpha = 0;

function videoClose(event:Event = null):void{
    webView.viewPort = null;
    webView.dispose();
    webView = null;
}
1
Why are you using StageWebView for the video? check this: adobe.com/devnet/flashplayer/articles/stage_video.html this one runs smoohly and you can control it as a normal video.Jevgenij Dmitrijev
I've looked into stageVideo but I cant' find any examples for Flash Professional CS5, they all use flash builder or flex etc. I'm also clueless about using classes/external .AS, if there was some sort of example source file that was just a simple .fla with inline code I would gladly use stageVideo.user1172903

1 Answers

2
votes

By the way, the webview object does not exist in the display list, and therefore can't be "embedded" in a movieclip.

If you want to control where it sits (as it will sit on top of everything) alter the rectangle:

webView.viewPort = new Rectangle(100, 100, 600, 480);

By making the rectangle smaller, you can shrink the visible area of the webview down small enough to display the flash content behind it.