0
votes

If I were to add a form (two inputs and a button) to a Flash project via an external class, could another team member change the visual characteristics of that form (skin, size, placement... etc.) in the .fla project file?

As it stands, I'm assuming that my AS3 user controls are added at compile time and thus are not accessible from the Flash IDE. But is there a way I can control a button's visual characteristics through the IDE and all of it's functionality through an external AS3 class?

Thank you!

1

1 Answers

1
votes

This is definitely possible. Just as you can define a document class for your FLA, you can do a similar process for a MovieClip.

Take your MovieClip in the library (presumably this contains your UI), right click and choose Properties and expand out that window. Fill it in something like this:

alt text http://img163.imageshack.us/img163/9787/symbolproperties.png

From there, you can define your base class in an ActionScript file, and gain access to the instance variable objects you defined within your MovieClip by defining them at the top of your base class.

MyCustomMC.as located in your class_root/net/dostrosity/MyCustomMC.as Flash might complain about you assigning your MovieClip to this class if it does not already exist. It will comment about creating a default class for you in that event. Hitting the checkbox is a way of confirming that Flash found your file, and hitting the pencil will open that file for editing.

package net.dotstrosity.MyCustomMC {

import flash.display.MovieClip;

    public class MyCustomMC extends MovieClip {

        private var okBtn:MovieClip;
        private var cancelBtn:MovieClip;
        private var nameField:TextInput;

        public function MyCustomMC() {
            //constructor that can add mouse events
            //to okBtn and cancelBtn that were placed
            //inside your MovieClip on the stage and
            //given the instance names "okBtn" and "cancelBtn".

            okBtn.addEventListener(MouseEvent.CLICK, pressedOk);
        }

        private function pressedOk(e:MouseEvent):void {
            //do something else...maybe...
            nameField.txt.enabled = false; //pseudo crap code
        }
    }
}