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

How to gotoandplay frame label when stage resizes?

New Here ,
Dec 03, 2018 Dec 03, 2018

Is there a piece of code that I can add into my Animate project that will gotoandplay a frame or movie clip when the stage resizes? I've got 2 movies - one for desktop and one for mobile. I want to go to the mobile version when the stage resizes. The code that I am putting together is not working and I don't know why as I'm just a beginner Any help or advice is much appreciated ...

var stageListener:Object = new Object ();

stageListener.onResize = function ()

{

if (Stage.width >= 600)

{

stageListener.gotoAndPlay("mobileArtwork");

}

}

Stage.addListener(stageListener);

158
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

correct answers 1 Correct answer

LEGEND , Dec 03, 2018 Dec 03, 2018

First thing, for a desktop/mobile project you should be working in a Canvas document, not AS3. AS3 documents don't work in any common mobile browsers.

Second, the Canvas canvas normally has fixed dimensions. It doesn't resize unless some code resizes it. And when it does, there's no event for it. At best you could run a ticker event that continuously monitors the stage's scale.

Third, resolution sniffing is a really bad way to tell whether you're on mobile. Many smartphones these days have a scree

...
Translate
LEGEND ,
Dec 03, 2018 Dec 03, 2018
LATEST

First thing, for a desktop/mobile project you should be working in a Canvas document, not AS3. AS3 documents don't work in any common mobile browsers.

Second, the Canvas canvas normally has fixed dimensions. It doesn't resize unless some code resizes it. And when it does, there's no event for it. At best you could run a ticker event that continuously monitors the stage's scale.

Third, resolution sniffing is a really bad way to tell whether you're on mobile. Many smartphones these days have a screen resolution equal to or greater than common desktop resolutions.

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