Solved

Referencing the properties of a RichEditableText child of a mxml composite component

Posted on 2010-09-15
4
489 Views
Last Modified: 2012-05-10
Hi, I have been reading about custom and composite components styles and skins, and tbh honest keep going round in circles trying to understand how i do the following.

I require a custom component comprising of a two richeditbabletext sitting within a parent container that will be used as the basis of a heading (like in a book) The size, font, background colour and some other properties on each seperate RET need to be changed independantly based upon incoming xml, which I have already got to the stage where it is ready to be used and is not a problem.

So far I have tried creating a custom mxml component, based upon group  and added two RTE, but when I use this component within the main application, I have no access to the properties of the RET components. The only way so far I have found to get some sort of control over the RET's is by using the setstyle property, but my gut instinct tells me this is the wrong way to do it.

Should I be using skin parts?, styles  or AS classes to declare the wanted properies . Based upon what I have said if someone could give me a generalized view of how to create a composite component it would be very much appreciated.

Regards Mr CONFUSED





0
Comment
Question by:BloodGrinder
  • 2
  • 2
4 Comments
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 33680833
Do you have to access the RETs themselves or you you want to make your custom component set them for you depending on the data it sees (I would prefer the later approach).

If you simply want to access the RTE instances, simply add two public functions to your custom component:

public function getRTE1():RichEditableText 
{
      return rte1;
}

public function getRTE2():RichEditableText 
{
      return rte2;
}

....
<s:RichEditableText id="rte1" .../>
...
<s:RichEditableText id="rte2" .../>

Open in new window

0
 

Author Comment

by:BloodGrinder
ID: 33681106
The second way as the component needs to react to the data. Thanks for your help
0
 
LVL 20

Accepted Solution

by:
ChristoferDutz earned 500 total points
ID: 33681764
Ok ... so the component has to have a property. Let's call it "value". So you have something like this. This is coded in ExpertsExchange and schould be treated as pseudo-code ... Just to give you the idea.

The idea is to give the component the data it should display. You can now do some calculations on that data and set some other internal properties, that you can use to style your RTEs.

Hope this get's you on the way.

<s:Group>
    <fx:Script>

        [Bindable]
        private var _value:Object;

        [Bindable]
        private var myColor:uint;

        public function set value(val:Object):void {
            _value = val;

            if(_value && (_value.property345423 > 3)) {
                myColor = Blue;
            }
        }

    </fx:Script>

    <s:RichEditableText text="{_value.property1}"/>
    <s:RichEditableText backgroundColor="{myColor}" text="{_value.property2}"/>
</s:Group>

Open in new window

0
 

Author Closing Comment

by:BloodGrinder
ID: 33682793
Thank you, its given me the pointers i needed. Regards
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
IE 11 Flash Player issue 7 238
How width columns automaticaly 4 432
How to convert pdf file to html file 8 394
Adobe flash player fails to install 12 307
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question