Issue: Develop an ActionScript 3 component for Flash CS3 that resizes correctly and has a live preview.
To find the solution, first, I searched the documentation, and I got almost nothing. Just references to how to customize a component or how to export a SWC file, things I already knew. Then I googled it, only to find out that the new component architecture is now FLA-based. There were only a few pages about it and even less pages explaining how to actually build a FLA-based component (one of them was in japanese, so it was useless). This guy spender has a very good step-by-step tutorial of how to build a simple FLA-based component. But those steps are so annoying: edit-save-reopen flash-copy-edit-close-reopen… and so on. And this guy’s component extends UIComponent which adds another 10K to your published SWF. Where is the old-style export to SWC solution? If it exists (and yes, it’s still there), why is it so poorly documented? To me, the documentation seems a little misleading, it gives you the impression that the FLA-based components are the only components supported by Flash CS3. But this is not true!. The new features brought by the new FLA architecture are cool, but you don’t need them every time you build a simple component. If you are, for example, building your ActionScript application in Flex and want to use it as a Flash CS3 component (again, without the styling features), follow the old steps:
– write your actionscript class which will be the base component class in your favourite editor
– create a new fla file
– add a MovieClip symbol to the library, check Export for ActionScript and Export in first frame, in the Class textfield write the path to your component’s .as file, set the Base Class to the class extended by the previously mentioned .as file (actually flash.display.MovieClip will do in most cases).
– make sure your component class defines a public “setSize” method as it is the method used for live previewing. Add all resize handling there. (for more information check out the fl.livepreview.LivePreviewParent class)
– right click the symbol in the library, select component defenition, type in the name of the .as file again in the Class textfield, check “Display in Components panel”, click OK
– right click again > Export to SWC file > save to (for windows) Documents and Settings/$user/Local Settings/Application Data/Adobe/Flash CS3/Configuration/Components/MyComponent.swc
– create another FLA file, reload the components panel (a small button with an arrow pointing down below the x button)
– search (in the Components panel) for the name of the directory created in the previous step, drag and drop your new component
Here is the code I used to create a trivial component that has a rounded rectangle as the background and a textfield which tells the width and height of the component:
Very nice article smackme. Very good work.
Brgds,
CPinho
By: cpinho on June 27, 2007
at 1:38 pm
Thanks mate!
By: smackme on June 27, 2007
at 1:53 pm
[…] Tutorial FL CS3- Building Flash CS3 components Smackme wrote a very nice article regarding Flash CS3 components. The good thing on his article, is that he defines when should we use the new CS3 features to build the components and when should we use the old way (Flash 8 and bellow).Β To check the code and the full article click here. […]
By: Tutorial FL CS3- Building Flash CS3 components « Flash Enabled - Get Ready With Flash… on June 28, 2007
at 1:00 pm
Wow, thanks for the posting. This is really helpful. I blog it to mine.
By: Song on June 28, 2007
at 8:20 pm
I am happy to help the community π
By: smackme on June 28, 2007
at 9:08 pm
Hey m8, enough visitors??? Hope so. Post more articles like these, and i will make sure you will get more.
All the best,
CP
By: cpinho on June 29, 2007
at 9:14 am
Yeah, since you posted it on your blog, the numbers went crazy π
I have plenty of article ideas (tips on component liquid layouts, skinning flex AS apps, E4X usage, UI components). I’ll defenetly post them in the nearest future. Right now I must take care of my diploma project π
By: smackme on June 29, 2007
at 11:47 am
Good, first get graduated, then post your articles.
Good luck m8.
By: cpinho on June 29, 2007
at 12:25 pm
The old V2 way still works. No need for AS3 fla based way since you can create components as .fla library content as well (an NO need for SWC compiling). Including custom UI and installation through .mxp.
By: PJ on July 5, 2007
at 9:39 pm
PJ, I didn’t really get what you are trying to say
By: smackme on July 7, 2007
at 9:09 am
[…] tutorial on how to build fla-based components for Flash CS3 can be found here (FlashBrighton) and here (you should read the comments […]
By: Create .fla components for Flash CS3 « Jumpeye Flash Team Blog on July 13, 2007
at 1:50 pm
thank you for the tutorial, it work fine.
I’have a question, how to get and use the properties defined in flash component inspector panel with this class ?
thanks in advance
By: Rik on July 14, 2007
at 10:01 am
@ Rik : Google for “Inspectable meta tag”, it’s the same for AS3 as it was for AS2. If you still can’t find anything good enough, get back here and I’ll give a nice and easy example.
Best regards!
By: smackme on July 15, 2007
at 10:28 am
I’ve been able to do all of the above, but once the new component loads in the Components panel, when I drag it onto the stage, nothing appears and the component doesnt appear in the library. Can anyone help? Thanks.
By: nerdabilly on July 18, 2007
at 3:26 pm
did you convert into swc file . once you will convert into swc it will so on library
By: devendra kumar on January 24, 2011
at 5:46 am
Never heard of such a problem before. If the component definition is valid than it should at least appear in the library once you drag it on stage or library. Double check everything and come back with a link to your files if it still doesn’t work.
Cheers!
By: smackme on July 19, 2007
at 8:15 am
[…] have described the steps to create a simple CS3 components here so I’ll just go on with the description of the classes. All the classes have a similar […]
By: Liquid Layout for Flash Components « ActionScript 3, Flash, Flex Reflections on July 20, 2007
at 1:01 pm
@smackme: It turns out, I was doing everything right, but there was a few lines of code it didn’t like. I tried to instantiate a custom class, and although the component compiled correctly, it wasn’t able to run properly, which explains why it wouldn’t import to the stage or the library. If I comment out the offending code, the component imports just fine, except that it doesn’t work right anymore. Are there any additional steps to use more than one custom AS class in a CS3 SWC component?
By: nerdabilly on July 23, 2007
at 2:07 pm
@nerdabilly: You can use as many classes as you desire in a swc component. For example I have like 25 of them in one of my complex components. They all work well together becuas eone instantiates another and the compiler knows which one to import into the swc. My guess is that you have a class that is defined by a symbol in the library which doesn’t end up in the swc and that causes your problem. If it is so, than drop an instance of that symbol in your component’s first frame. That should solve it.
By: smackme on July 23, 2007
at 2:56 pm
[…] just so this post hasn’t been a complete waste of your time, check this out for a great tutorial on creating SWC components in Flash […]
By: Nerdabilly.com » Blog Archive » update. Also, creating SWCs in Flash CS3. on July 23, 2007
at 2:59 pm
@smackme: you’re right. It turns out that it wasn’t an issue of multiple classes, it was just an issue of some bad code in one of them.
By: nerdabilly on July 25, 2007
at 3:07 pm
I get the error below when adding the component-code you wrote in your article. I am doing this on a mac. Do you think you could send me the exaple component and the .fla, so that I can find out what I am doing wrong?
Error:
RangeError: Error #2006: The supplied index is out of bounds.
at flash.display::DisplayObjectContainer/removeChildAt()
at MyComponent/::init()
at MyComponent$iinit()
at Untitled_fla::MainTimeline/Untitled_fla::frame1()
By: RW on August 4, 2007
at 12:15 pm
Sorry, my bad. I didnt realise that I had to draw something in the MovieClip before exporting it to SWC.
By: RW on August 4, 2007
at 12:27 pm
Hi, thanks for what is a useful and time saving article.
It worked fine for me. Now I’m trying to dispatch a custom component event (from within the draw method) with the dispatchEvent(new Event(“customevent”));
and set a listener in an application, but I cant figure it out why the c1.addEventListener(“”customevent”,someHandler), where c1 is a component instance on the stage and someHandler is a custom function. it’s not working. Any idea ?
By: Bob on August 9, 2007
at 9:02 pm
@Bob: well it depends… what do you mean isn’t working? is it giving an error or simply does nothing? perhaps the event doesn’t get dispatched in the end
By: smackme on August 10, 2007
at 7:41 am
There is no error, just simply does nothing. In the someHandler function there is a trace(“Event handler call”) that is never displayed. Any clue ?
By: Bob on August 10, 2007
at 9:43 am
Find a way to show me the code, I’ll tell you what’s wrong.
Is draw method ever called? Do you see the component on stage? π
By: smackme on August 10, 2007
at 3:39 pm
The code is the same as yours, having an import flash.events.Event statement on top and a dispatchEvent(new Event(βcustomeventβ));. The component is on the stage and works fine and the draw method is called.
By: Bob on August 11, 2007
at 1:08 pm
How to make component’s property accessible in the Component Inspector?
By: Torero on August 12, 2007
at 11:51 am
Rik asked the same question!
The answer is somewhere on this page π
By: smackme on August 12, 2007
at 4:22 pm
I have made a component for the test, using your code. In Flash all right. I create extension for Dreamweaver. For an insert of a component on page I use a command “dw.getDocumentDOM().insertFlashElement(‘MyComponent.swc’)”, in MXI file. At attempt to insert component Dreamweaver gives out the message ” The MyComponent Flash Element could not be found “. With Flash elements ActionScript 2.0, similar problems were not. Can you help me?
By: Designer on August 19, 2007
at 11:24 am
I’m really sorry but I am not familiar with dreamweaver and DOM architecture
By: smackme on August 19, 2007
at 1:00 pm
hi, I read you article is great.
10x man, I spend maybe 2-3 days for searching info for my own until find this. So again 10x
I have 1 question, I make scrollBar, and have MCs in it with instance names. While I compile it I get this:
1119: Access of possibly undefined property arrowR_mc through a reference with static type classes:scrollBarComponent.
arrowR_mc is one of my MCs in it
scrollBarComponent is my class in package classes. What I do wrong?
By: Stanislav Stankov on August 20, 2007
at 3:48 pm
hi,
I read [b]public class LivePreviewParent[/b]
Here what is written in it
onResize(width:Number, height:Number):void
Resizes the component instance on the Stage to the specified dimensions, either by calling a user-defined method, or by separately setting the width and height properties.
I think it would be line setSize, but wtf it didn’t work.
By: Stanislav Stankov on August 20, 2007
at 4:31 pm
@ Stanislav:
1. The best way to overcome this problem is adding your display object using the code (addChild())
2. I don’t really understand what you are asking π
By: smackme on August 20, 2007
at 8:58 pm
1. but they are already in the MC, and they have graphics in it. And how to add when they are undefined? Do I must init them like variables in class?
2. I write function setSize, I was working in author environment. Next read livedocs about “LivePreviewParen”. There is written onResize(….
So is like setSize, but it didn’t work, why?
By: Stanislav Stankov on August 20, 2007
at 9:31 pm
1. Ok, so here is the deal: if you want to access the components you place on stage and give instance names to them, the first thing you try is create a member with the same name and find out that it doesn’t work. The thing is that by creating this member you overrite that property that would have givven you acces to arrowR_mc. Not defining anything and trying to access arrowR_mc won’t work either since the compiler doesn’t see any arrowR_mc defined in your component class and throws an error. The solution is accessing it through component_mc[“arrowR_mc”]. That you may store in an instance property and have further acceess to it. Hope it solves the problem.
2. You were looking in the wrong place. Here is what you needed to see:
“The LivePreviewParent class supports the definition of a setSize() method that uses width and height values to resize a component. If you do not define a setSize() method, this object sets the width and height properties individually.”. Which means that if your component doesn’t define a public setSize() method, it will resize and distort according to the new width and height. IF you define that method, it won’t resize, unless you explicitly tell it to, in the setSize() method.
Have fun, make kids and love your wives! Amin π
By: smackme on August 21, 2007
at 9:54 am
Your framework is pretty good. However its not efficient at all since it does not use invalidation. I could call setSize 100 times and it will redraw 100 times yet only get updated on the screen once. It is better to call invalidate when ill call draw on the screen update. Look at the documentation under Stage.invalidate().
By: Trenton Ahrens on September 28, 2007
at 3:41 pm
Flash CS3 bug?
I built a component with a String Definition. This definition is automatically added to my Component Class’s variables. And it does, compiles correctly, and runs fine. But… it throws compiler errors from the Component’s Class file saying that the variable thats being defined in the Component’s Definitions, is undefined. Technically, it is undefined to the Class file document, but Flash should see that its a Component’s Class, check for the var in the component that it thinks is undefined, and if found, ignore it.
Is this a Flash bug, or am I missing some sort of of Class to Component connection?
I guess I could just ignore these compiler errors, but that a lot to ask π
Thanks!
-Joe
By: Joe Weitzel on November 28, 2007
at 3:11 pm
hello smackme
nice name, but i’ll refrain thanks
so ive got flex builder 2 & flash cs3 (on mac osx) over here and i used flash cs3 with this very helpful article of yours to create a .swc in my components dir. it was all nice and worked great, thanks.
the next idea was to start a new AS3 project in FB2 and use the ‘Add SWC…’ button of the ‘Library Path’ tab to add said SWC to my FB2 AS3 project. only when i hit OK and opened the new project I was instantly treated to an error msg that read:
unable to load SWC SWCTest005A.swc
do you think i am trying to do something that isn’t possible or just going about something the wrong way?
By: richard willis on December 4, 2007
at 11:54 pm
[…] References : 1.http://www.adobe.com/devnet/flash/articles/creating_as3_components.html 2.http://www.flashbrighton.org/wordpress/?p=31 3.http://www.flashgamer.com/2007/12/inspectable_metadata.html 4.http://www.jumpeyecomponents.com/blog/2007/07/13/create-fla-components-for-flash-cs3 5.https://flexion.wordpress.com/2007/06/27/building-flash-cs3-components […]
By: Flash CS3 component creation : introduction « saumya on December 5, 2007
at 5:06 pm
to richard:
Flex Builder’s ‘Add SWC’ feature is used mainly to add a shared class library, not visual assets.
If you are trying to create a component in flash and use it in flex then you need to follow another tutorial. I can’t find it right now. I’ll post it as soon as i find it
By: smackme on December 6, 2007
at 1:36 pm
Can u tell me the way how can I write this to workable?:
[Inspectable( type=”??????”, defaultValue=”Name of reference a TextField”, name=”textFieldLink”)];
I just wanna plass a texfieldreferece for a component. How can I do that?
By: joel on January 13, 2008
at 3:47 pm
I can’t get this componet live preview to work. If I put some graphics (sub MovieClip) inside MovieClip in component’s FLA, I can see it when instance component in container FLA (Authoring enviroment), but nothing about dynamicaly made graphics inside setSize(); and draw(); function.
I hope you can help me π
By: Goran Grubic on January 19, 2008
at 6:58 am
Hi guys,
Thanks for posting your findings! I’ve been through the same shit the last months due to the lack of documentation. Check out this page:
http://www.adobe.com/devnet/flash/articles/creating_as3_components.html
At the very end of the page you can find PDF downloads providing almost 120 pages of component creation information. Lot’s of it’s great, but the guy that wrote it is so knowledgeable that he tends to forget some very basic stuff. I found several “bugs” in the docs that will give readers a hard time. I got my component working now and I really do not want to sift through these 120 pages again to correct errors and omissions. It’s lot’s of gold here though, so make sure you check it out.
By: Jensa on February 5, 2008
at 8:57 pm
[…] Building Flash CS3 components (Smackme’s post) […]
By: Exploring a unified component workflow between Flex and Flash « Flash Enabled Blog on February 21, 2008
at 12:38 pm
thanks for a great and informative article
By: Software at Cost on February 21, 2008
at 7:15 pm
hi!!
Very heplful article.
Can i ask you another thingh?
Is it possible to make a component and give the possibility to change the skin directly from the component inspector as a parameter?
And is it possible to show the changing in runtime?
i’m tring in this way but doesn’t work (the component show the skin changing only after compyling!!)
protected override function draw():void
{
trace(“entrato in draw”)
if(skinName == null)
skinName = getDefalutSkinName();
if (skin == null)
{
var classDef;
try
{
classDef=this.loaderInfo.applicationDomain.getDefinition(skinName);
trace(“entrato in blocco try”)
}
catch (e:ReferenceError)
{
//thereβs no guarantee the try block will work
//as the skin may be missing
//in which case, abort!!!
return;
}
skin = new classDef as MovieClip;
trace(skin)
addChild(skin);
}
else
{
trace(“entrato in else”);
classDef=this.stage.loaderInfo.applicationDomain.getDefinition(skinName);
skin = new classDef as MovieClip;
addChild(skin);
}
skin.width = width;
skin.height = height;
}
[Inspectable(defaultValue=”BoxSkin”, type=String, name=”skin name”, variable=”skinName”)]
public function get skinName():String
{
return _skinName;
}
public function set skinName(skinName_:String):void
{
_skinName = skinName_;
draw();
}
By: Boxbuilder on February 23, 2008
at 2:54 pm
i’ve another question to ask.
i declared some protected property:
and the default value in the inspectable metadata,
but if i don’t change the default value in the component inspector the default value isn’t setted and the variable value is null.
confused!
By: Boxbuilder on February 23, 2008
at 4:00 pm
Boxbuilder,
Unfortunately I don’t have time to post new articles, it would definitely get on the list. One thing is for sure – what you are trying to achieve is possible
I didn’t quite get the last question, would you please give a short example?
By: smackme on February 25, 2008
at 4:18 pm
first of all thanks for reply!
for second sorry in advance for my terrible english.
I’ve just resolved my previous problem
But I’m still in trouble.
I try to explane you wath i mean.
I’ve develop a component that change skin at runtime (with livepreview) when the user set a skin parameter from the component inspector.
I was able to do this, but…
If the resource skin (movieClip) isn’t compiled in the live preview or in the swc file
the asset isn’t displayed
Now i want to make available for the user the possibility to change the component skin with a movieClip in library
but since it does not compiled the live preview don’t show the result.
I haven’t see any example of this, but i need these features because i’m trying to make a pysic component framework.
I’ve a physic shape component that provide to add dynamically a pysic body to the shape. But if the shape is displayed as a boundingBox the user can not place the shape in the right way.
I hope you understand me…
Ciao
By: Boxbuilder on February 25, 2008
at 5:20 pm
Let me get this straight – you want to make your component use some assets from the library and see the changes on live preview?
Haven’t tried it but I am not so sure it’s possible. You can load visual assets using server side scripts and see the changes in the preview, though.
Ciao
By: smackme on February 26, 2008
at 8:48 am
Hi All,
Really great article for creating a component without extending UIComponent
Great.
By: sanjeev on June 25, 2008
at 1:02 pm
Can’t get your sample to work properly but I thought I would share this. It seems to be the same procedure as stated above, but with missing code
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=665&threadid=1373400#5003941
By: SJ on June 27, 2008
at 7:46 pm
greetings smackme,
wanted to start by saying that your tutorial really got us off the ground as far as making oldschool->newschool components.
One thing I’ve been having trouble with however: is there a way to get it so the constructor can accept params/args ? seems the panel in the component definition box isnt quite what it seems?
— basically, when trying to turn a class into a component, i get the ‘expected 0 parameters’ type error, even though the code-level constructor is still ready for them.
when it comes down to it, im just trying to just instantiate a class… but not reveal all of its juicy code to clients — is this more a job for compiled clip or…?
Cheers,
By: Schurke on July 18, 2008
at 6:59 pm
Schurke,
I don’t know if I got it correctly, but are you talking about the inspectable properties that appear in “Properties” panel of a custom component?
By: smackme on July 21, 2008
at 3:11 pm
not so much. basically, ive created a component that is a text based button. if i have it in the library of my project, i can access its constructor through code (whatever = new k_textButton() ) (as the goal is really just to be able to ‘hide a class’ in the fla to make it’s proprietary code difficult for the client to access). HOWEVER when i try to include arguments in the constructor… the constructor fails saying that it expected 0 parameters… so it -almost works- but not quite. works fine obviously for static-method classes and classes with no args in their constructors.
— i may be totally crossing purposes here. my mates and i operate entirely code-based with nothing on the timeline… im wondering if ‘compiled clip’ is closer
By: Schurke on July 23, 2008
at 5:18 pm
[…] https://flexion.wordpress.com/2007/06/27/building-flash-cs3-components/ […]
By: LOV8 » Blog Archive » Creating AS3.0 Components Links on July 25, 2008
at 4:53 am
@Schurke: the way I see it, everything in your library (well, except the assets) is a movieclip, and the movieclip doesn’t allow any constructor parameters, hence the errors.
You could create some accessor functions for the parameters you need, and set them after you instantiate your button. Redraw the component when a value is changed, and don’t forget to give it some default values.
Peace!
By: smackme on July 29, 2008
at 8:26 am
First of all, great article, so simple as opposed to that un-deciipherable UIComponent tutorial out there…!
I’m building a component that will display an rss feed. all is well until i try to feed it with some xml as a parameter. i cant get it to read it… this is what i’ve done:
[Inspectable(defaultValue=””, type=String, name=”XML Path”)]
public function set path(p:String):void
{
xmlPath = p;
trace(“xmlPath = ” + xmlPath);
handleXML();
}
this code is never called – i dont get to see the trace, let alone the call to handleXML().
Any ideas?
Thanks.
By: YoS on July 30, 2008
at 9:24 am
If everything else is correct, then upon changing the value of path property, the accessor function should fire and you should see the trace.
Do you see any other trace (from other properties). May be you have “omit trace actions” checked π
Post your code if nothing helps
Tchuss
By: smackme on July 31, 2008
at 11:36 am
Here’s an interesting issue. Has anyone tried tweening an instance of one of these SWC components via the timeline? It doesn’t do anything. Even putting a component in different places, rotations, etc. in keyframes has no effect. What’s going on with that?
Before anyone suggests it, I know that you can put the component in a MovieClip and move that. However, then my nice LivePreview screws up. The point of this project is to make some stretchable, tweenable components for some less code-savvy Flash folk. But if they can’t use the timeline with LiveView, then there’s no point.
By: Zack Jordan on September 5, 2008
at 11:19 pm
Hello smackme
I am facing a problem with component development where my component contain other components. After pasting my fla file to Components folder, Flash shows other components which are used in my component. I tried your workaround but it doesnβt works for me. Could you please explain a bit on how not to display the default components which are used in my component.
What I have done:
I created a Component Shim for my component by
1.creating a blank MovieClip
2.naming its class as MyComponentShim
3.then converted it to Compiled clip
4. Rename as MyComponentShim
5. Replace default Component Shim with the one I created above and then compile my component again.
6. Paste it to Components Folder.
Please help me with this. I donβt want to display the default components used by my Component.
Looking forward to your response.
β
Chetan Sachdev
By: Chetan Sachdev on September 13, 2008
at 5:10 pm
Where do the components appear? In the library?
By: smackme on September 15, 2008
at 7:44 am
Great tutorial, thanks!
Started to play with CS3 Fl components just yesterday. It is interesting that Adobe has fixed the way live preview behaves in develop-time, when the component is rotated: now the w and h values passed to setSize method are correct (NOT the width and height of the rotated bounding box of the component, but the width and height of the component regardless of the rotation).
However, in runtime it’s all the same story, the w an h values are the bad-old-buggy ones. Just try it using your sample component – put it on stage, rotate, inspect the dev-time dimensions, then preview it in runtime. Is it just me, who thinks that the components should be normally rotateable via help of transform tool? Of course, I can put the rotation as a component parameter, but then I am forced to set also the w and h parameters, otherwise scaling it with the helkp of transform tool will mess it all up.
By: Passiday on October 5, 2008
at 7:33 am
@smackme
Sorry, for my late reply. I get it rolling. Do you have any suggestion regarding which class to extend UIComponent, Sprite or MovieClip.
Thank You
By: Chetan Sachdev on October 21, 2008
at 12:57 pm
Any chance of you posting up the source .as and .fla file for your test component? When I try to create a component with the source above in CS4, I get errors about “package” being invalid in ActionScript 2.0 – seems that I must be doing some tiny thing wrong, which is resulting in it trying to compile my source as AS2.
Would be nice if you had the source .fla and .as up to troubleshoot issues like this. Thanks!
By: Social Networking on December 10, 2008
at 1:29 am
Hi, Smackme
Firstly thanks for this great article. I’ve made it run and it’s really simple just follow your steps above.
But is still got confuse with ComponentShim and it seems not to be simple to implement. Can you explain more about it?
thanks again.
By: kido.do on December 26, 2008
at 10:04 am
Eureka! Iβve done it! After seemingly endless trial and error, I finally succeeded at making an SWC-based component entirely with Flash CS3, and my own custom UI, all written in AS3. Iβve just posted a tutorial along with the source:
http://studio.barliesque.com/blog/2008/12/as3-component-custom-ui/
Thanks “smackme” for your article posted here, which gave me a start. Getting the control panel to work seamlessly with the component, however, gave me plenty to chew on. Please have a look and let me know what you think!
Unfortunately, the I was unable to solve was the rotation bug described above. And, regarding another issue described above, it appears that components can not be tweened on the timeline. At least not in CS3… maybe in Flash CS4?
By: Barliesque on January 1, 2009
at 12:50 am
Thanks for the article. This is my first go at switching to AS3 component dev from AS2 in Flash. I’m not sure where I’m going wrong here, but your example doesn’t work for me.
When I add the compiled swc to the stage, there is no preview, and it won’t allow me to set the width and height. Setting these values via the Property Inspector in Flash simply resets them. Compiling the swf then generates this error:
RangeError: Error #2006: The supplied index is out of bounds.
at flash.display::DisplayObjectContainer/removeChildAt()
at MyComponent/init()
at MyComponent()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
By: rollingsj on January 20, 2009
at 8:53 pm
I obviously spoke too soon. After some experimenting, I discovered that you have to put *something* in the base MovieClip for the example to work. Drawing a rectangle in the first frame of the component clip fixed these issues, and now it’s up and running nicely.
Thanks again for this quick (not 120 pages) tutorial.
By: rollingsj on January 20, 2009
at 9:08 pm
I was struggling at first to make this example work. I really have to thank rollingsj for making it explicit that you have to put something in the movie clip to work. I wouldn’t have known without this comment!
At any rate, nice article smackme! Informative and straight to the point!
By: Ardee Aram on June 9, 2010
at 10:14 pm
really this tutorial is great and fantastic
By: Balaji on March 27, 2009
at 10:38 am
Thanks for the putting the time in to create this tutorial. It was very helpful.
One thing I forgot to do β which caused problems initially β was to save my .fla before I created my component. I walked through the tutorial again, saving my .fla first, then defined the component, and everything worked!
Thanks again.
By: Novian on April 9, 2009
at 11:16 pm
Very helpful !! Thank you so much !!
By: JJChen on August 13, 2009
at 3:02 am
Hi Smackme
I’am just wondering if you could spare me some time about tween and skinning a combo box using a UI componat and though dynamically/ prorammic action script…….In Action Script Flash 9 CS3…..
Is there a tutorial or zip file containing .fla…to follow
Thank You
Mr H
By: Mr H on October 22, 2009
at 7:50 pm
thanks for you post…. very help full… i also did the same as u did.. 1st read adobe live doc.. but didn’t found perfect solution what i was looking..than i got your blog’s url from google…
once again thanks a lot..
π
By: shankarthapa on December 21, 2009
at 7:07 am
Hi Smackme,
I got one error while importing that to another fla.
“one or more files were not imported because there were problems reading them”.
please help me to solve the issue.
TanQ
Midhun D
By: midhun on February 8, 2010
at 7:57 am
hi,
i was wonderful article thank you.
I have one doubt regarding the MXP package development.
If i am making a MXP it shows under the Standard Component. How can i make its having somthing like Video Component or a custome name.
By: midhun on February 17, 2010
at 11:43 am
Very nice!!!
By: west4east on March 20, 2010
at 12:17 am
Excellent tutorial!!!!
I was trying to learn this from long time and i was in impression that it will be very difficult… But your tutorial changed my impression and today i made my first custom component w/o any senior’s help!!!… very nice tutorial…thanks yaar!!!!Just wanted to know how we can change component’s properties through “properties” panel (inspectable properties )..need tutorial like above tutorial… Thanks in advance…
By: Roshan C on April 30, 2010
at 8:59 am
[…] https://flexion.wordpress.com/2007/06/27/building-flash-cs3-components/#comment-974 […]
By: How to develop your own Flash AS3 Component « The Claustrophobic Coder on June 9, 2010
at 10:49 pm
thanks for information articles. top
By: Search PDF, Ebook on June 10, 2010
at 5:52 am
[…] 5. Building Flash CS3 components […]
By: 10 Flash Components Tutorials | WebBuildingInfo: How to build a website on June 21, 2010
at 2:08 pm
I’ve completed the test and it shows perfectly! Now to test out what else I can do.
This is so perfect, and it’s amazing that Adobe don’t make this information available themselves. The article they do have for creating components on their site is RIDICULOUSLY huge – 29 GIGANTIC pages – a complete nightmare to read.
Awesome – this is the best info I’ve found on the web all year! I’m almost feeling emotional π
By: Dave Stewart on August 30, 2010
at 12:01 pm
One thing though – you do leave out the step to create a shim (movieclip) on frame one of the clip. This caught me out until I realised why the new component was coming up empty.
Also, your list of points could do with being a) a numbered list and b) make the sub-points nested bulleted lists. Would be far easier to read.
Ta.
By: Dave Stewart on August 30, 2010
at 12:03 pm
[…] Components Learning Guide for Flash: Creating custom components Custom Parameter UIs for Components in Flash CS3 | BIT-101 Macromedia Flash – Creating components in Macromedia Flash MX Building Flash CS3 components – ActionScript 3, Flash, Flex Reflections […]
By: Creating Components in Flash | tutorials blogs on December 19, 2010
at 12:55 pm
Thanks for this piece of tutorial!
Event after 4 years after you posted it, it is still the most helpful piece of info around π
Regards,
Tadej
By: Tadej Kanizar on January 18, 2011
at 7:27 pm
Glorious weblog! I actually love how it’s simple on my eyes in addition to the details are properly written. I’m questioning how I may well be notified every time a brand new post has been made. I have subscribed to your rss feed which must do the trick! Have a nice day!
By: Mora on September 20, 2011
at 10:49 am
Thanks!
I have stopped blogging quite a while ago; but yes, if anything pops and for some mysterious reason new posts would appear, the rss should the trick.
Good day to you too!
By: Dennis on September 20, 2011
at 11:33 am
This post has really given me an easy work. Thank you very much for sharing this. It has helped me big time. I hope there will be more articles to be posted in this blog.
My Last Post:
Great Custom Cabinets
By: jackierey2010 on January 26, 2013
at 12:41 pm