Real easy question

Is css only compatable with the textArea component? Or can it be used with dynamic fields too?

It can be used with any text type…in fact you can even use CSS to skin the flash v2 components…there is a tutorial at http://www.ultrashock.com

Well the css wasn’t working until I used a textArea component.

I will give you a snippet that works in my site it is what controls my homePage text.


homeStyle = new TextField.StyleSheet();
//creates the new Style Sheet.
homeStyle["owner"] = this;
homeStyle.onLoad = function(success) {
     //homeInfo is the name of my Dynamic text field.
     this.owner.homeInfo.styleSheet = this;
};
//Path to CSS doc
homeStyle.load("updates/style.css");

I know this works…again like I said above I use this in my site I cut and pasted it.

Could you explain bits of the code, mainly the [“owner”] part, and why it’s significant.

Thanks for the help too.


homeStyle["owner"] = this;
homeStyle.onLoad = function(success) {
	 //homeInfo is the name of my Dynamic text field.
	 this.owner.homeInfo.styleSheet = this;
};

the homeStyle[“owner”] = this; what I am trying to achieve is homeStyle.owner = this; but if you try and put that line in and compile it the compiler will throw an error because their is no default owner property. So you can declare one by writing it as I have. Though the line is only truely significant for the line in the onLoad function when I declare homeInfo.styleSheet = this; more than likely you could do it by just doing this


homeStyle.onLoad=function(success){
	homeInfo.styleSheet = this;
}

and that would probably do the trick but to be safe I do the homeStyle[owner] = this; to make sure that the add styleSheet directive points to the right MC object and then the right text field object.

Clear as mud? :-/

Im sorry if I am not explaining it clearly…there are other posts on it I just don’t know where they are…
So to conclude things i use the “owner” property to make sure that the directive homeInfo.styleSheet = this points to the right object (this.owner)…
Im trying here I hope that helps?!

Yea, it pretty much makes sense. Thanks.