Creating flash cs3 component

Hi,
There is great and easy way to create flash based component
in flash cs3 using action script 3.0.
I am going to make a simple My button component which will
behave likely same as flash native button component.
You can modify this according your requirement this is just
you give an idea about how we can go for creating a component in
flash cs3.
Follow these steps…
1. Create a fla file and save this file with any name
2. Create a movieClip and draw a rectangle shape on first
frame.
3. Right click on movieclip in library, select linkage
4. Provide class name in text field area [MyButton] (you can
use any name here which should matched with your class)
5. Click Ok button
6. Write class [MyButton]
(you can copy and use this)
* author @ sanjeev rajput
* [email protected]
* A flash action script 3.0 based component without extending
UIComponent class
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.MouseEvent;
import flash.events.Event;
import fl.motion.Color;
public class MyButton extends Sprite{
private var _tf:TextField;
private var _Label:String="My Button";
private var _bgColor:uint=0xCCCCCC;
private var _rollOverColor:uint=0xFFCCCC;
private var _borderColor:uint=0x000000;
private var _borderThickness:int=1;
private var _width:Number = 100;
private var _height:Number =100;
private var _background:Sprite;
public function MyButton() {
init();
createChildren();
initEventListeners();
draw();
//-------------property section [Start]
[Inspectable]
public function set Label(lbl:String){
_Label=lbl;
draw();
public function get Label(){
return _Label
[Inspectable]
public function set bgColor(color:uint):void{
_bgColor=color;
draw();
[Inspectable]
public function set borderColor(color:uint):void{
_borderColor=color;
draw();
[Inspectable]
public function set borderThickness(thickness:int):void{
_borderThickness=thickness;
[Inspectable]
public function set rollOverColor(color:uint):void{
_rollOverColor=color;
//-------------property section [End]
private function init():void {
trace('welcome');
_width = width;
_height = height;
scaleX = 1;
scaleY = 1;
removeChildAt(0);
private function initEventListeners():void{
addEventListener(MouseEvent.MOUSE_OVER, eventHandler);
addEventListener(MouseEvent.MOUSE_OUT, eventHandler);
private function eventHandler(event:Event):void{
if(event.type == MouseEvent.MOUSE_OVER){
toggleColor(_rollOverColor);
if(event.type == MouseEvent.MOUSE_OUT){
toggleColor(_bgColor)
private function createChildren():void {
_background = new Sprite();
_tf = new TextField();
_tf.autoSize = "center";
_tf.selectable=false;
addChild(_background);
addChild(_tf);
protected function draw():void {
toggleColor(_bgColor);
_tf.text = _Label;
_tf.x = Math.floor((_width - _tf.width)/2);
_tf.y = Math.floor((_height - _tf.height)/2);
//width = _tf.width;
private function toggleColor(color:uint):void{
_background.graphics.clear();
_background.graphics.beginFill(color, 1);
_background.graphics.lineStyle(_borderThickness,
_borderColor, 1);
_background.graphics.drawRoundRect(0, 0, _width, _height,
10, 10);
_background.graphics.endFill();
public function setSize(w:Number, h:Number):void {
_width = w;
_height = h;
draw();
7. Now right click again on your movieclip in library and
select component definition.
8. In class name text field provide same class name
[MyButton]
9. Click on ok button
10. Right click again on movieClip in library and select
Export SWC file.
11. Same your exported SWC file in (For window only)
[c:\Documents and Settings\$user\Local Settings\Application
Data\Adobe\Flash CS3\en\Configuration\Commands\
12. Now just open another new flash file open component
panel/window reload component you will your component in component
panel with MyButton name.
13. Drag your custom component on stage provide inputs form
property window and text it.
Enjoy!

Lt.CYX[UGA] wrote:
> if anyone is using Flash CS3, try creating a flash
movie, using the FLVPlayer
> component to play an flv video and make it an executable
projector. Run it
> fullscreen and watch how the screen just stays black
when the video should
> appear. If you stay windowed, it works fine.
>
>
steps to reproduce:
> 1. create flash movie
> 2. put an FLVPlayer component on a frame that's not the
first (for testing
> purposes)
> 3. before the projector reaches the frame with the
FLVPlayer component, change
> it to fullscreen (by script or CTRL+F)
>
>
observed behaviour:
> not only the video doesn't play, but the whole screen is
black until the
> player goes back to windowed mode
>
>
expected behaviour:
> video should play
>
>
remarks:
> if you skip step 3, video plays correctly
>
Works just fine.
Made new movie, on frame 2 places Full screen action, on
frame 5 placed video component
and stop(); action attached to frame. Projector pops large
following by video playing
just fine.
I tried variety, first frame, many frames, all on one. Not
able to reproduce your problem.
Works on first go.
Best Regards
Urami
Beauty is in the eye of the beer holder...
<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
</urami>

Similar Messages

  • Flash CS3 Component Help?

    I have a menu component I've created in Flash CS3. I'm
    running into a small problem. Currently, in Flash, I create an
    array in the first frame of the movie and then assign a
    "menu_items" property (an array) on my menu object as that array.
    The array is an array of specialized menu item objects that is
    defined in a separate class. In Flex, I would like to do this:
    <mxml:macMenu>
    <mxml:macMenuItem image="btn1.png" click="{clickHandler}"
    />
    <mxml:macMenuItem image="btn2.png" click="{clickHandler}"
    />
    .....etc
    </mxml:macMenu>
    I'm not quite sure how I can get my object to realize the
    children should be part of the array inside of macMenu called
    "menu_item" and at the same time make sure they are an instance of
    my menu item class.
    I have posted the full AS3/Flash CS3 source of my menu at
    http://www.adambergman.com/as3/macMenu.html
    Any help or ideas are appreciated!!!

    Hi Rajesh,
    I've seen your query all over the internet, so I should warn you I don't believe it's possible to disable a List Item.
    For that you should use Josh Tynjala's open source Advanced List (http://code.google.com/p/flextoolbox/downloads/list).
    Best Regards,
    Filipe.

  • Create Flash Professional component in Flash Builder 4.7

    Hello,
    I would like to make a Flash Professional Component in Flash Builder.
    This is a lot easier for code hinting and you don't have to use a FLA file.
    Also you don't have to right click the component in the library and "export component SWC"
    The ONLY difference i've seen in the swc file files between a Flash Professional Component and a Actionscript Library Project (created in Flash Builder), is 3 lines of code in the catalog.xml file.
      <components>
        <component className="centomedia.components:CvPlayerComponent" name="CvPlayerComponent" icon="CvPlayerComponent_IconFile.png"  />
      </components>
    Is this in any way possible?
    Thanks for the help!

    Come on, someone must have an answer? no?
    even if the answer is, impossible

  • Use Flash CS3 component in Flex

    As a bit of a n00b, this may be a stupid question...
    If I were to get a component made for use with "Flash CS3",
    once it's compiled to a swf & fla, is it entirely usable in
    Flex [Builder] 3 ? Say I didn't want to re-skin it, and it was
    fully programable via AS?
    Is this a "it depends"? Is it a "absolutely, you just need
    CS3 to compile it first"?
    Thanks in advance,
    AJ

    "GuinnessIsGoodness" <[email protected]>
    wrote in message
    news:gbe131$c20$[email protected]..
    > As a bit of a n00b, this may be a stupid question...
    >
    > If I were to get a component made for use with "Flash
    CS3", once it's
    > compiled
    > to a swf & fla, is it entirely usable in Flex
    [Builder] 3 ? Say I didn't
    > want
    > to re-skin it, and it was fully programable via AS?
    >
    > Is this a "it depends"? Is it a "absolutely, you just
    need CS3 to compile
    > it
    > first"?
    I think you need to either use it as an as file or compile it
    as a swc,
    unless you want to load it into a swfloader.
    HTH;
    Amy

  • How to build a custom Flash CS3 component

    I just googled in the hope to find some resources about how
    to build custom Flash CS3 components, but nothing turned up. I also
    couldn't find any info on Adobe's Flash developers center.
    Do you know of any resource that sheds some light on this
    subject?
    If not then I'll have to try to find my way around custom
    components by learning from the ones that came with Flash CS3 I
    guess.

    Flash CS3 has been out for a few weeks. At this point, your
    best bet is Amazon books or Barnes & Noble. I've read a few
    books that should shed light on the subject. Otherwise, you'll need
    to wait a few more weeks while people start hashing it out and
    posting it to blogs and other sites.

  • Skinning Flash CS3 component

    I posted this in General but haven't gotten a reply, and now
    I'm beginning to wonder if this must be accomplised with
    ActionScript.
    It's great that you can double click a component, open it up,
    and put your own artwork right in there and set the 9-slice scaling
    guides so it behaves properly. Lightyears better than trying to
    skin in any previous version of Flash.
    But, the rendered SWF does not seem to respect my artwork
    dimensions. For instance, I have a Slider component for which the
    default track is about 3px tall. I have my own artwork which is
    about 6px tall. While I can put my artwork in the skin and it
    scales perfectly, it squashes it down to 3px tall when rendered.
    Likewise, my 9x12 thumb gets scaled when rendered to 13x13(which is
    the default skin's thumb size) when rendered. Although the graphics
    appear the right size in Flash authoring, it appears to get scaled
    at runtime.
    How do I avoid this? How do I define the base dimensions for
    the skin graphics?
    Thanks for any advice.
    Post in General forum:
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=194&threadid=1324684

    Changing the avatar size doesn't seem to have any affect. Do
    you know what the Avatar is for? It appears to be a bounding box of
    some sort, but resizing it doesn't seem to change anything.
    Actually, I notice that if I open the avatar, it says it is
    22x80, although the scaled version in the Slider is 3x80. It seems
    to be some sort of shared component. If I resize the contents of
    the avatar, all my buttons change, but the sliders don't actually
    change. Sadly, it seems like "3" is a hard coded value somewhere in
    the source. Blah.

  • CS3 Component Creation With Preset

    I have created a CS3 component with around 10 inspectable
    parameters. Now I would like to add another Inspectable parameter
    with enumeration such that it contains a list of presets for the
    rest of the 10 parameters. When i select any one preset from the
    enumerated list the other 10 parameters should be populated with
    some predeifned values and I want those values to be reflected in
    the parameter panel in the IDE. How can i go about it?

    I have created a CS3 component with around 10 inspectable
    parameters. Now I would like to add another Inspectable parameter
    with enumeration such that it contains a list of presets for the
    rest of the 10 parameters. When i select any one preset from the
    enumerated list the other 10 parameters should be populated with
    some predeifned values and I want those values to be reflected in
    the parameter panel in the IDE. How can i go about it?

  • Creating metadata in Flash CS3 and reading it in AS3

    Is there a way to store metadata in a library symbol in Flash
    CS3, and then read it in AS3? For example, I want to have the
    following code run:
    m_Metadata = 'You're cool!'
    I need this data before I can play the movie clip. Is there a
    way to store this? I've been trying to find a solution, but it
    looks like I'm just going to have to load in a separate XML file
    with the data.
    Thanks!

    Unfortunately there's no simple way to add instance level
    code in Flash CS3 or CS4 with AS3. This is a significant authoring
    tool deficiency in my opinion.
    Making a component... depending on what you want to do, there
    can be a lot of overhead. There may also be some very flaky/buggy
    behavior in Flash CS3 with custom components if your experience is
    anything like mine. However, for basic metadata, try this:
    1. Select the Symbol in the Library
    2. Right click, choose Component Definition...
    3. In the Parameters data grid you can add
    parameters/properties. Make sure you set the "Variable" field as a
    unique identifier for each parameter. These are the properties
    you'll use in AS at runtime to retrieve the values.
    4. Now on each instance on the canvas you can go to the
    Parameters tab and enter custom values for each parameter.
    5. At runtime, you should be able to access the values via
    instance_name.variable_name
    I believe that will work without actually creating a
    component class and making it functional.

  • Customizing DataGrid component in Flash CS3 using AS3

    Can anyone please explain how to customize the DataGrid
    component in Flash CS3 using AS3???
    How do you remove/change the grid lines for the rows and
    colums?
    How do you remove/change the border?
    My day has been lost searching for this answer. Flash
    Documentation is worthless and Google finds nothing with regards to
    AS3. ASDGRH.
    Thanks in advance,
    TedWeb

    I hope you've found a resolution to this by now, but I just noticed the discussion title when posting a captioning issue.
    In a nutshell, create a listener on your FLVPlayback module with a VideoEvent.SKIN_LOADED event. You'll also need to set the showCaptions in your FLVPlaybackCaptioning object to true. Apparently, if the captions are set to false when the player object loads the skin, the captions aren't recognized and your captions toggle will require an extra click to activate the captions.
    Here's the link to another discussion on the same topic with all of the details:
    http://kb2.adobe.com/cps/402/kb402452.html
    Also, have you had any issues with the caption button in the FLVPlayback skin not showing up? That's my current issue. Here's the discussion for it:
    http://forums.adobe.com/thread/796423?tstart=0

  • Flex Component Kit for Flash CS3

    Hi,
    I created a flex component using the component kit for Flash
    CS3. The component contains a vector image wrapped as a MovieClip.
    In my flex application I add the component as child to a
    Canvas. It works well if i add it like -
    <mx:Canvas id="container" >
    <local:MyComponent />
    </mx:Canvas>
    or like -
    container.addChild (new MyComponent()); //DISPLAYED
    However, the component is not displayed when I do the
    following -
    var array:Array = new Array(new MyComponent());
    container.addChild(array[0]); //NOT DISPLAYED
    Can somebody tell me why this is so?
    I would also like to know if such components can be
    instantiated using flash.utils.getDefinitionByName.
    I tried it but I get Error #1065: Variable 'componentName' is
    not defined
    Could somebody please tell me what is going on?

    Hi bolaughlin,
    Thanks for you reply.
    Error 1065:
    import MyComponent;
    var comp:MyComponent = new MyComponent(); //Error 1065
    //Where MyComponent is the Flash CS3 clip that was converted
    to Flex component
    I have a workaround for this -
    I first add the component as an Mxml tag with visibility
    false and then remove the component
    with actionscript. Now all instantiations work normally (this
    includes all components in the SWC).
    <mx:Canvas id="container" >
    <local:MyComponent visible="false" />
    </mx:Canvas>
    and in <mx:Script>
    container.removeAllChildren();
    var comp:MyComponent = new MyComponent(); //Works
    var anotherComp:MyOtherComponent = new MyOtherComponent();
    //From the same swc; This also works.
    I have a feeling this problem is similar to the 'shared
    fonts' problem that
    existed with Flash MX and below.
    Anyway, even though I don't really know whats happening, my
    project can
    move ahead. Hopefully some Guru will explain this.
    Until then...thank you very much.

  • How to create a comment form in Flash CS3

    I am trying to create an add comment form in Flash cs3. I
    have the background design and the text input areas and sub mit
    buttons. But how do I get the submit button to add the comment to a
    different area in the same flash file? My inputs and buttons are on
    the left side of the stage and my display comments is on the right
    side of the stage. How do I connect the two?

    The user types something into a text input space and when the
    user then uses the submit button, you want that same, user entered,
    text to display in another, different, text area? If that's the
    case then make that second text area a dynamic textfield and set
    its text property to the text property of the input text
    space.

  • How can I create a photo gallery in flash cs3, Iam a beginner in flash

    How can I create a photo gallery to put into my current flash site Iam creating? Using  flash cs3, can anybody suggest any tutorials (noting complicated with me being new to flash cs3)
    When going on line I saw that maybe you can use Dreamweaver, XML, or even Photoshop can anybody explain the difference between using one or the other?
    THanks

    Indeed, google ftw.
    For example:
    +as3 photo gallery flash tutorial
    reveals many including this one:
    http://www.flashmagazine.com/Tutorials/detail/as3_photo_gallery/

  • Project created in Flash CS3 & Flash CS5 crashes both Safari & Firefox

    I have a user with a brand new image including Snow Leopard 10.6.6 and the Adobe CS5.  When creating a project in Flash CS5 and then trying to view it in Safari & Firefox the plug-in crashes which then brings down the browser with it.  I went and installed Flash CS3 (as this is what he is used to using) and the problem still persists.
    Any ideas?

    anyone?

  • Flash 8 component not working in flash cs3

    Hi, I have a flash 8 component (well, it was written for
    flash 8 but it claims to be compatible with flash 7+).... which I
    am trying to get to show up in the components panel in Flash CS3
    trial version. I have the flash CS3 extension manager, it shows up
    in there, but it doesn't show up in my components window in flash
    cs3. What do I need to do to get the flash 8 component to show up
    in flash CS3??

    Hi,
    When you open a new file in Flash CS3, you got the option to
    choose either AS2 file or AS3 file, the components are different on
    each one.

  • Created website in flash cs3, wont open once hosted...

    I tried to find the answer here in the forums but couldn't,.  I'm sorry, i bet this question has been posted before..
    I created a website in flash cs3.  published it so that I now have an index.html, home.swf and AC_RunActiveContent.js file.
    when I upload these to host, the url just shows blank white page.  I called customer support of host, godaddy, and they said the server could not find the swf file.
    are they named incorrectly?  I'm new to this...
    thank you very much

    According to a quick check there is no file by the name of...
    So... two things:
    1. Never use spaces in the names of files you intend to use on the web.  That space can break code up.  It is best to use an underscore if you need to, but not an empty space.
    2. After you change the name and get things updated in the code for the new name, make sure your spelling is correct.
    After you have loaded the newly named file you should be able to access it directly on the web using ... newfilename.swf
    where newfilename is whatever new name you give it.

Maybe you are looking for