This is the personal weblog of Greg Burch.

Thursday, January 16, 2003

Ok here is one of the tips I promised:

Skinning, its tedious...and boring. The outcome is great though so it has to be done. I am sure it will get easier as it evolves but for now we must deal with it. I spend most of my days creating components and the parts that take me most time are documenting and skinning setup. Well to save a teeny bit of file size, and save some time I made a very small addition to the registerSkinElement in some of my components.

Up till now I have always had seperate symbols for the enabled and disabled state of a component, and those were placed in a parent symbol with an enabled and disabled frame. And each of those seperate symbols had smaller pieces that made up the skin called skin elements. So you would see stuff like this.

MyComponent Left Side:

component = this._parent._parent;
component.registerSkinElement(face_mc,"face");
component.registerSkinElement(darkshadow_mc,"darkShadow");
MyComponent Left Side Disabled:
component = this._parent._parent;
component.registerSkinElement(face_mc,"disabledFace");
component.registerSkinElement(darkshadow_mc,"disabledDarkShadow");
and of course the same for the middle and right etc...as you can see that if anything changes, its a hassle to make changes. And its very repetitive which is very very boring. And when having a lot of elements (my typical skins have 5 skin elements in each sub symbol) it just gets out of hand.

So I figured I would save myself some time and hassle and override the registerSkinElement method in my component to be slightly smarter. You could make the registerSkinElement really smart and have it handle a lot of situations....but for this example I want to keep it simple so people don't go about ruining their components extensibility by making lower level skinning support...too smart.

Check out the code below:

MyComponentClass.prototype.registerSkinElement = function(skinMCRef, propName, isGlobal){
	propName = (this.enabled) ? propName : "disabled"+propName;
	return super.registerSkinElement(skinMCRef,propName, isGlobal);
}

Such a small bit of code, that saves me a ton of time. this.enabled represents the enabled state of my component. Since my component redraws when its disabled or enabled all of the elements re-register. And if my component is disabled it appends the "disabled" string to the front of the propName. This means the once "enabled" skin takes the form of the "disabled" skin by registerSkinElement being smart enough to prepend the propname with disabled. You can see how this would come in handy in other situations too, such as when you have a selected item...you can check for that here. But be careful, you want to make sure you don't waste cpu, and most importantly you don't ruin the extensibilty of your component.

Post your questions in the comments, I hope I described the situation ok :).
10:40:28 PM    comment []


Macromedia just released a press release announcing that they have acquired Presedia.

Presedia Express enables non-technical professionals to use existing office productivity tools like Microsoft PowerPoint, annotate their presentations with audio, and combine these two elements... [mesh on mx]

Check it out the press release.

Clarification: I immediately noticed that the president of Presedia was Kevin M. Lynch I asked about this and it IS NOT the same Kevin Lynch from Macromedia. They just have the same name.

I can't be sure but I think I got a presentation from these guys a couple years ago. They had a product (like mentioned) that converted power points (and a few other things) to Flash. If this is them....their product is great. If its not them...its still a good addition :)
5:38:48 PM    comment []


© Copyright 2003 Greg Burch.
 
January 2003
Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Dec   Feb

Home

Articles
Live Previews
Common Component Issues
Flash Remoting
SharedObjects
FlashVars
Extending Components
__resolve and apply
XML 2 DataProvider

Macromedia WebLogs
Jeremy Allaire
mesh on mx
jd on mx
An Architect's View

Other WebLogs
Peter Hall
Eric Dolecki
Flash the Future
jdb cyberspace
Branden Hall
OnRelease
Josh Dura
moik78
Full As A Goog
Flash Magazine
Claus Wahlers
Arul Kumaran
Phillip Torrone
Quasimondo
Guy Watson
Robert Hall


Resources
Macromedia Mobile Development Center

Books
Flash Design for Mobile Devices

Flash Enabled

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.