Skip to main content
Participant
September 7, 2014
Answered

Why does width=stage.fullScreenWidth; function inproperly ?

  • September 7, 2014
  • 1 reply
  • 834 views

Peace be upon you

I have a timebar in my flash android app (testing sample), that I want to extend horizantally to the full screen width (in all phones and tablets).

I tried many many things, visited all programming websites .. and I made use of this useful article Supporting the multiple screen sizes of multiple devices in Adobe AIR | Adobe Developer Connection

and tested them on many devices but still, something is still wrong!

when I use

1- Object(root).bar.width =stage.fullScreenWidth ;                      // the timebar fits the width but animates LATE

2- Object(root).bar.width =stage.stageWidth;                              // the timebar fits the width but animates LATE

3- Object(root).bar.width =stage.width;                                        // the timebar doesn't fit the width but animates rightaway!

4- Object(root).bar.width =Capabilities.screenResolutionX;        // the timebar fits the width but animates LATE

here the sample:testing sample.fla - Google Drive


can someone tell me why is the latency in the timebar animation !??

I want my timebar to be in it's original speed (fast) and have it to fit the screen width in any size ..

Thanks in advance ..

This topic has been closed for replies.
Correct answer kglad

I tried it without Object(root) and it still didn't work .. though my code isn't nested at all .. no errors to .. it's just a latency and no fit for width

here's a screenshot from my phone , you see the second bar starts rightaway!

but the other ones start late .. but they all finish in the same time!!
why??? they also won't fit the phone's screen width :/

i coded them in this order

1- bar1.width =stage.fullScreenWidth ;            

2- bar2.width =stage.stageWidth;                    

3- bar3.width =stage.width;                             

4- bar4.width =Capabilities.screenResolutionX;       

do you have a solution??
sorry for bothering you with this ,,


i can't duplicate that issue using your code.  all 4 bars fill the screen width when the app starts and there's no latency.

you can confirm by creating a new fla with 4 bars and that code.  test.

if you fail to see the problem in a new fla, you can conclude there's something (other than your code) causing whatever problem you're seeing.

1 reply

kglad
Community Expert
Community Expert
September 7, 2014

there's probably latency because your code doesn't execute immediately.  ie, it appears to be on a nested timeline.

put this on frame 1 of the main timeline if you're going to add code to timelines,

bar.width=Capabilities.screenResolutionX;

Participant
September 8, 2014

thank you for replying kglad,

but actually, the sample itself has no other lines of code ..

when I used 3- Object(root).bar.width =stage.width;           // the timebar doesn't fit the width but animates rightaway!

No latency happened .. but why is there latency with the other three ways I tried?? (as I mentioned in the question)

*I tried each one alone

kglad
Community Expert
Community Expert
September 8, 2014

you probably have latency because the code is nested.

to confirm, remove your Object(root) path.  if there's an error, your code is nested.

and stage.width is probably not what you want to use.