PDA

View Full Version : [AS3] Components within a Sprite that's attached to a Class


mizwo
10-25-2009, 12:22 AM
Hi Folks,

on the stage in my Flash IDE there is a Sprite, within there are some standard v3 Components. The Sprite is attached to the class SomeComponentsWrapper.

Within the class i define all the variables, which are also the instance names of the component instances.

What i want is to arrange the components in flash, rather that adding them by code. how to solve that? in AS2 this was no problem.


ReferenceError: Error #1056: Property someButton in SomeComponentsWrapper cannot be created.
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at SomeComponentsWrapper()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at version006_fla::MainTimeline()




package {

import flash.display.Sprite;
import fl.controls.Button;
import fl.controls.ComboBox;
import fl.controls.Slider;

public class SomeComponentsWrapper extends Sprite {

var someButton:Button;
var someComboBox:ComboBox;
var someSlider:Slider;

public function SomeComponentsWrapper() {

}

}

}

Thanks in advance.

mizwo
10-25-2009, 12:55 AM
solved, the vars simply have to be public.