Solved

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

Posted on 2010-09-15
4
494 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
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): …
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

630 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