PDA

Click to See Complete Forum and Search --> : Flash Question


John G
07-21-2008, 10:57 PM
so I've got this series of code which is assigning some background MC's width/height from a loader component. This line of code is run from the onComplete throw of the standard loader component (flash 8).


whichHolder2.imageBG._width = whichHolder2.bigImageLoader.width + 28;
whichHolder2.imageBG._height = whichHolder2.bigImageLoader.height + 28;



whichHolder2.imageFG._width = whichHolder2.bigImageLoader.width;
whichHolder2.imageFG._height = whichHolder2.bigImageLoader.height;

whichHolder2.imageButton._width = whichHolder2.bigImageLoader.width;
whichHolder2.imageButton._height = whichHolder2.bigImageLoader.height;
trace("THIS IS THE HIT SPOT WIDTH " + whichHolder2.imageButton._width);


whichHolder2.imageText.web.text = websiteTextArray[(currentNavX -1)][currentNavY];
whichHolder2.imageText.title.text = titleTextArray[(currentNavX -1)][currentNavY];
whichHolder2.imageText.body.text = descTextArray[(currentNavX -1)][currentNavY];

whichHolder2.imageText._y = whichHolder2.bigImageLoader.height * .5;

It works fine. EXCEPT this part:
whichHolder2.imageButton._width = whichHolder2.bigImageLoader.width;
whichHolder2.imageButton._height = whichHolder2.bigImageLoader.height;
trace("THIS IS THE HIT SPOT WIDTH " + whichHolder2.imageButton._width);
imageButton is an empty button (just the hit spot)
But assigning it new width and height values, the same values everything else gets makes the button equal 0 width, 0 height and is driving me insane. Even assigning it static numbers doesn't work.

What am I missing? Button Objects have _width and _height right?

John G
07-21-2008, 11:41 PM
nvm, Just using an MC to do it instead works.

tZ
07-21-2008, 11:53 PM
FYI

If imageButton is a instance of the class SimpleButton than you need to populate the various state with a display element such as Sprite instance.

AS 3

/* pause */
var butPause:Sprite = new Sprite();
butPause.y = 104;
var loader3:Loader = new Loader();
butPause.addChild(loader3);
loader3.load(new URLRequest('content/videoplayer/a/pause.png'))

var butPauseOver:Sprite = new Sprite();
butPauseOver.y = 104;
var loader3Over:Loader = new Loader();
butPauseOver.addChild(loader3Over);
loader3Over.load(new URLRequest('content/videoplayer/hover/pause.png'))

var butPauseb:SimpleButton = new SimpleButton(butPause,butPauseOver,butPause,butPau se);
buttonInterface.addChild(butPauseb);