Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Actionscript 3 android videoPlayer set size issues

New Here ,
Mar 02, 2017 Mar 02, 2017

I am creating a Android app prototype on Adobe Animate, I have been able to load a YouTube video using the API and it loads correctly and I have been able to position it as well, however I can't figure out how to set the size of the video. I have used videoPlayer.setSize but this doesn't make a difference when i test it.

This is my code:

var videoPlayer: Object;

var loader: Loader = new Loader();

loader.load(new URLRequest("http://www.youtube.com/v/mJsvmscPY9w?version=3"));

loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);

loader.x = -200;

loader.y = -430;

function onLoaderInit(e: Event): void {

  addChild(loader);

  videoPlayer = loader.content;

  videoPlayer.addEventListener("onReady", onPlayerReady);

}

function onPlayerReady(event: Event): void {

  videoPlayer.setSize (200, 100);

}

Any ideas?

Thanks

Jenny

TOPICS
ActionScript
930
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 02, 2017 Mar 02, 2017

so what do i need to do?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 02, 2017 Mar 02, 2017

I think that even if you could load the swf it would fail. That swf is expecting to be playing in a web page, where it can get at the other things it will need. The video file for example.

If the overall goal is to show a YouTube video in your app, look at using the embed system to show the video in a StageWebView. You can set the size of that view so that your other buttons are not obscured. I think that it should even work on iOS, because it would give you the HTML5 compatible version.

See this article on how to get and use the embed code:

How To Add a YouTube Video to Your Web Site

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 02, 2017 Mar 02, 2017

:

function onLoaderInit(e: Event): void {

  addChild(loader);

this.addEventListener(Event.ENTER_FRAME,enterframeF);

}

function enterframeF(e:Event):void{

    if(loader.width>0){

        loader.width = whatever

loader.height= whateverelse

        this.removeEventListener(Event.ENTER_FRAME,enterframeF);

    }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 02, 2017 Mar 02, 2017

what do you put in the 'enter frame' parts??? as mine is all in the same frame

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 02, 2017 Mar 02, 2017

Even while sat on the same frame the enterframe event happens as many times per second as the frame rate you've set for the FLA.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 02, 2017 Mar 02, 2017

so is there no solution?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 02, 2017 Mar 02, 2017
LATEST

If you mean a solution to getting the size of a loader working, kglad's answer 27 would do. If you mean a solution to how to play YouTube videos in an AIR mobile app, my answer 26 would do.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines