5 Replies Latest reply on Sep 11, 2008 1:12 PM by ShaF10

    Newbie Help with passing data

    ShaF10
      Hi Guys

      Please take a look at the code below



      I want to set the font size by getting the data field from the array and processing that variable in the fontSize() function. How can I do this ? Please do go easy on me as I have been programming in flex only for an hour.



      .
        • 1. Re: Newbie Help with passing data
          greg h_
          Hi ShaF10,

          1 hour! Man, you are doing great!!!

          I have posted a runnable solution of your code at the following link:
          http://flexflashvideo.com/codesamples/flex/adobeforums/08/09/10/events/

          You can right-click on the swf at the link above and select "View Source" to see the solution code.

          The primary change in the code is that in an event handler an event object is automatically created and passed. So I changed the signature on method fontSize() to datatype the param value as a ListEvent. (In this case, the ancestor class Event would also have sufficed.) I also changed the event to be handled from click= to change=.

          At runtime, event classes provide references back to the object. I chose to use the currentTarget property but in this case the target property would also have worked. Since currentTarget is a reference to the object, and in this case the object is the instance of ComboBox, I then reference the property selectedItem on ComboBox and returned the value of that object's the data property.

          Please post back regarding whether the above answers your question, and if you find it helpful :-)

          Best regards,

          g
          • 2. Re: Newbie Help with passing data
            ShaF10 Level 1
            Hi Greg

            lol, thanks. Excellent, it worked a charm and a very good explanation too. I need some help with something else. I want to create a layout similar to the following doc viewer: http://www.scribd.com/doc/69/Scribe-for-the-Mighty?query2=scrib+upload

            It has a scrollable region and a panal at the top which is fixed. What layout/controls will I need to use in order to achieve this ?

            Regards
            Shaf
            • 3. Re: Newbie Help with passing data
              ShaF10 Level 1
              Ok, I have afew more questions if you don't mind.

              I am trying to add the ability to underline, select font, indent, add bullet points/numbers etc but am having difficulty in doing so. There is no property in the TextRange function which handles some of these.

              It looks like TextFormat() does but Im guessing since its an object I cannot insert it directly into the textrange var ? See code below(doesnt work may I add):
              • 4. Re: Newbie Help with passing data
                Level 7

                "ShaF10" <webforumsuser@macromedia.com> wrote in message
                news:gabg7g$sqc$1@forums.macromedia.com...
                > Ok, I have afew more questions if you don't mind.
                >
                > I am trying to add the ability to underline, select font, indent, add
                > bullet
                > points/numbers etc but am having difficulty in doing so. There is no
                > property
                > in the TextRange function which handles some of these.
                >
                > It looks like TextFormat() does but Im guessing since its an object I
                > cannot
                > insert it directly into the textrange var ? See code below(doesnt work may
                > I
                > add):
                >
                >
                > import flash.text.TextFormat;
                >
                > private var txtFormat:TextFormat = new TextFormat();
                >
                > private function setUnderline():void {
                > var tr:TextRange = new TextRange (
                > docArea, true, docArea.selectionBeginIndex, docArea.selectionEndIndex
                > );
                > tr. = txtFormat.underline="true";
                > }
                >
                > private function align():void {
                > var tr:TextRange = new TextRange (
                > docArea, true, docArea.selectionBeginIndex, docArea.selectionEndIndex
                > );
                > tr.textAlign("CENTER");
                > }

                Look at the htmlText property and/or the Rich Text editor.

                HTH;

                Amy


                • 5. Re: Newbie Help with passing data
                  ShaF10 Level 1
                  Can you give me some example of how to put it into use. I learn best through examples. Im not familar with the reference yet.