Solved

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

Posted on 2010-09-15
4
491 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses

738 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