Actionscript Adding Custom Class To .fla -
I miss something fundamental. I have a very simple custom square that draws a circle and a checkbox, And to check the check box only allows that circle to pull the phantom. A checkbox component has been manually added to my .fla library.
Mys From the Action Panel of the Flow Project:
var ball: dragball = new dragball (); AddChild (ball); My custom class .as file (located in the same folder as the .swf)
package {import fl.controls.CheckBox; Import flash.display.Sprite; Import flash.events.MouseEvent; Public Class Expands Drag Ball Sprites {Private Wear Ball: Sprite; Private var check box: checkbox; Public Function Dragball (): Zero {drawTheBall (); MakeCheckBox (); AssignEventHandlers (); } Private function drawTheBall (): zero {ball = new sprite (); Ball.graphics.lineStyle (); Ball.graphics.beginFill (0xB9D5FF); Ball.graphics.drawCircle (0, 0, 60); Ball.graphics.endFill (); Ball.x = stage.stageWidth / 2 - ball.width / 2; Ball.y = Step. Stage High / 2 - Ball. Height / 2; Ball.buttonMode = True; AddChild (ball); } Private Work makeCheckBox (): Zero {checkbox = new checkbox (); Checkbox.x = 10; Checkbox.y = step .stage high-30; Checkbox.label = "Allow Drag"; Checkbox.selected = false; AddChild (checkbox); } Personal Function Assignment Holders (): Zero {ball.addEventListener (MouseEvent.MOUSE_DOWN, dragSprite); Ball.addEventListener (MouseEvent.MOUSE_UP, dropSprite); } Personal function dragSprite (evt: MouseEvent): zero {if (checkbox.selected) {ball.startDrag ();}} personal work dropSprite (evt: MouseEvent): zero {if (checkbox.selected) {ball.stopDrag () ;}}}} .fla is compiled in the following error, which I do not understand
TypeError: Error # 1009: Can not use an empty object reference property or method in dragball_flaw :: maintime / frame1 () in the dragball / drill ()
The problem here is that you For Rg are trying to reach the first stage of the day. The best way to do this is to add an event listener to your constructor for the event .ADDED_TO_STAGE, and once it sets X and Y in relation to this event step.
Comments
Post a Comment