Here is a small sample of my code. The Page Class is created in a module called Journal. The function to update the text of the TextArea is in the Journal so I dont think 'this' will work.

...
public function updateText(e:FocusEvent):void {
var uj:JournalEvent = new JournalEvent(JournalEvent.UPDATE);
                uj.body = e.currentTarget.text;
                uj.entryID = ; // *Here is my Problem*
                dispatchEvent(uj);
            }
        ]]>
</mx:Script>
<mx:DateFormatter id="df" formatString="M/DD/YYYY" />

<!-- BOOK STARTS HERE -->

<rs:Book id="myBook" x="{Math.round(this.width/2-400)}" y="10" width="800" height="500"
        openAt="0" autoFlipDuration="600" easing="0.7" regionSize="150"
sideFlip="true" hardCover="true" hover="true" snap="false" flipOnClick="true" dropShadowEnabled="true" dropShadowColor="0x000000" borderColor="0x000000" shadowDirection="right" shadowDistance="5" borderStyle="solid" borderThickness="1">

<!--Book Cover *This is mxml version of the pages I am adding through ActionScript and need to update*.-->
<rs:Page>
<mx:Image source="@Embed('assets/img/sumeco/dreamscan.jpg')" />
<mx:TextArea y="30" horizontalCenter="0" text="My Journal" fontFamily="Georgia"/> <mx:Label left="30" right="30" y="90" fontFamily="Arial" fontSize="12" color="#000000" textAlign="center" text="By {UserDataModel.getInstance().firstName}" />
</rs:Page>


On 2/21/2010 1:01 AM, Alex Harui wrote:

If you have:

Public class Page
{
    private var myTextArea:TextArea;

    private var journalID:String;

    override protected function createChildren():void
    {
        myTextArea = new TextArea();
myTextArea.addEventListener(FocusEvent.FOCUS_OUT, myFocusOutHandler);
    }

    private function myFocusOutHandler(event:FocusEvent):void
    {
        // the ‘this’ pointer is the instance of Page
        // event.currentTarget is the TextArea
        journalID = TextArea(event.currentTarget.text);
    }
}


On 2/20/10 8:25 PM, "Wally Kolcz" <[email protected] <[email protected]>> wrote:






    I have an instance of a Class (Page) which has a textarea on it
    which is
    editable. I added an eventlistener to the TextArea for
    FocusEvent.FOCUS_OUT. When the FocusEvent (e) gets to the hander,
    I can
    use e.currentTarget to get the value of the TextArea, but I need a
    value
    in a variable in the same instance of the Page Class (journalID).
    I have
    been looking through the debugger but I cannot figure out how to get
    that value.

    Long story short I need the variable journalID on the same Class that
    contains the TextArea.

    Thanks.






--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui <http://blogs.adobe.com/aharui>

I in

Reply via email to