Hallucinodrum
04-14-2008, 02:11 AM
Hi, im trying to make a site utilizing oop. Being new to oop in general and even after reading some books about it, I've been left with some uncertainties.
So far my structure is this:
Main.as - inits everything, defines settings
Content.as - contains everything that is seen, adds content
Data.as - used for xml loading of dynamic content, probably should extend content right?
Listeners.as - dispatches events (ie. nav button click)
Effects.as - defines anything that uses a tweening engine (ie.TweenLite) also should extend content?
So one of the first problems I came across is when I tried to extend the content class on the effects class so I could access the objects to be animated. Say I wanted to have my background sprite always be the same height of the stage. So I added a listener in listeners.as for the stage resize event, and when resized have it call an function in effects.as called backgroundResize() that sets the background height and stage height to be the same. Everything works up until when effect.as calls on the background instance. It does change the size of it as can be seen by a trace function, but Im not seeing it on my screen. So I tried this stage.getChildAt(0).height = stage.stageHeight, and that worked, but what a roundabout way to do that.
Sorry, Im bad at trying to explain these kind of problems, I lack the proper syntax. So what am I doing wrong, what should my site structure be? What do your sites look like? Please give me some advise, Ive been struggling with this for awhile now. Thankyou.
So far my structure is this:
Main.as - inits everything, defines settings
Content.as - contains everything that is seen, adds content
Data.as - used for xml loading of dynamic content, probably should extend content right?
Listeners.as - dispatches events (ie. nav button click)
Effects.as - defines anything that uses a tweening engine (ie.TweenLite) also should extend content?
So one of the first problems I came across is when I tried to extend the content class on the effects class so I could access the objects to be animated. Say I wanted to have my background sprite always be the same height of the stage. So I added a listener in listeners.as for the stage resize event, and when resized have it call an function in effects.as called backgroundResize() that sets the background height and stage height to be the same. Everything works up until when effect.as calls on the background instance. It does change the size of it as can be seen by a trace function, but Im not seeing it on my screen. So I tried this stage.getChildAt(0).height = stage.stageHeight, and that worked, but what a roundabout way to do that.
Sorry, Im bad at trying to explain these kind of problems, I lack the proper syntax. So what am I doing wrong, what should my site structure be? What do your sites look like? Please give me some advise, Ive been struggling with this for awhile now. Thankyou.