|
|
|
#1 |
|
Member
Join Date: Jun 2009
Posts: 49
|
Hi
I am making a simple image gallery, basically their are 5 pictures positioned on the stage and when one is clicked it centers itself on the screen then expands its height and width to fill the stage, most of the time this works fine but for some reason the very first time an image is clicked it doesn't center itself vertically only horizontally, I'm sure this must be a simple problem i just can't pick it up. here is my code: PHP Code:
|
|
|
|
|
|
#2 |
|
it's automatic
Join Date: Jul 2000
Location: NaN
Posts: 2,000
|
Try adding a trace right after you set stagew and stagey:
PHP Code:
The way to ensure there's a stage property to read is to set up a listener for ADDED_TO_STAGE where you handler calls and init function that starts up your movie. PHP Code:
|
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jul 2001
Location: San Jose California
Posts: 127
|
Jbard - I noticed when creating dynamic boarders that preview (ctrl+enter) will short the height value of the stage. For example if the stage height was 200px the boarder would show up as 100px in preview. Viewing the file by double clicking on the swf or putting it in a page things look normal.
Could this preview bug be the issue? |
|
|
|
|
|
#4 |
|
Member
Join Date: Jun 2009
Posts: 49
|
hmmm, well i seem to have the opposite problem. if i use (ctrl + enter) everything works fine. But when i use the swf thats when i get my problems.
|
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Jul 2001
Location: San Jose California
Posts: 127
|
Have you tried what jAQUAN mentioned? Drop a dynamic text box onto the stage and then see what it's spitting out when the file is embedded into your html.
I noticed that AS3 stage calls have problems if you are exporting as Flash Player 9. If that is the case you might consider hard coding your stage values if it's only the images that are what differs in size. |
|
|
|
|
|
#6 |
|
Member
Join Date: Jun 2009
Posts: 49
|
ok this is really wierd, i just added the trace values and they would always appear as the correct number and everything would work fine, then i tried in my swf and i would still get the error. so i added two text fields which displayed the stagew and stageh properties and i havent got the error in my swf. then i took the text fields away and got the error straight away. i dont know how these text fields could stop the error but they appear to be doing so.
|
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Jul 2001
Location: San Jose California
Posts: 127
|
wacky
|
|
|
|
|
|
#8 |
|
rabid_Delineator
Join Date: Dec 2003
Location: Orlando, Florida
Posts: 307
|
what packages are you importing ?
|
|
|
|
|
|
#9 |
|
Senior Member
Join Date: Jul 2001
Location: San Jose California
Posts: 127
|
This seems to work for my stage object problem. Maybe it might work for yours.
PHP Code:
|
|
|
|
|
|
#10 |
|
Member
Join Date: Jun 2009
Posts: 49
|
at the moment i have this writen in the main time line so the only things i import are these:
import fl.transitions.Tween; import fl.transitions.easing.*; |
|
|
|
|
|
#11 | |
|
Senior Member
Join Date: Jul 2001
Location: San Jose California
Posts: 127
|
Quote:
|
|
|
|
|
|
|
#12 |
|
rabid_Delineator
Join Date: Dec 2003
Location: Orlando, Florida
Posts: 307
|
its definitely an order of operations thing. I wouldnt be surprised if your two vars , stagew and stageh , do not have values yet , at the time in which your timer starts. You are declaring them way down into your code. Try declaring and instantiating them as the very first thing you do.
|
|
|
|
|
|
#13 |
|
Member
Join Date: Jun 2009
Posts: 49
|
Yes i declared my variables at the top of my code and added a settimeout function and everything seems to be working fine.
Thank you very much for all your help i really appreciate it
|
|
|
|
|
|
#14 |
|
Senior Member
Join Date: Jul 2001
Location: San Jose California
Posts: 127
|
nice!
|
|
|
|
|
|
#16 |
|
rabid_Delineator
Join Date: Dec 2003
Location: Orlando, Florida
Posts: 307
|
cool , mark your thread as resolved
|
|
|
|
![]() |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|