Welcome, Guest
  • Author Topic: Error Access of Undefined Property when make the Cmponent separate with Function  (Read 1548 times)

    hinomotoblade

    • Seasoned Programmer
    • ***
    • Posts: 131
    • Flash Never Die :D
      • View Profile
    I have a problem here.. :), I try to make separate Component in my Flex..

    this is the part of myFirstMxml code :

    Code: [Select]
    <mx:Script>
    <![CDATA[
    private function _doLogin(event:MouseEvent):void {
    if (!usernamein.length || !passwordin.length) {
    Alert.show('Username / Password masih kosong !!','Login Failed',Alert.OK);
    } else {
    Alert.show('Your Login is '+usernamein.text,'Login Confirm Box',Alert.OK);
    }
    }
    ]]>
    </mx:Script>

    then this is all of mySecondMxml code that just copy paste from the original before i made the different Mxml

    Code: [Select]
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Form height="122">
    <!--Nah ini From Component || FormHeading(label Form) dan item2nya FormItem-->
    <mx:FormItem label="Username">
    <mx:TextInput id="usernamein">
    </mx:TextInput>
    </mx:FormItem>
    <mx:FormItem label="Password">
    <mx:TextInput id="passwordin" displayAsPassword="true">
    <!--displayAsPassword="true" buat TextInputnya jadi Password Display-->
    </mx:TextInput>
    </mx:FormItem>
    <mx:FormItem>
    <mx:Button id="submitLoginin" label="Login" click="_doLogin(event);">
    </mx:Button>
    </mx:FormItem>
    </mx:Form>
    </mx:Canvas>

    Then in myFirstMxml there are appear two error,
    that the id Component that i declared in the function are undefined Property, but thats worked if i didnt separate that.. :)

    Thank you very much.. :)
    « Last Edit: 01/22/10, 08:41 by hinomotoblade »
    Huihihi~ :D

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Hi hinomotoblade
    Can you summarize, perhaps in 5 lines your problem?. This will help you in getting answers. I know people tend to give as much information as he can, but this is a second step, the first is just to get the idea and atract others to your problem

    Jorge

    hinomotoblade

    • Seasoned Programmer
    • ***
    • Posts: 131
    • Flash Never Die :D
      • View Profile
    Oh okay Jorge.. :)

    I am sry, because before this, there several question that want me to explain what i assign, populate, and step back to tell how i use that.. :)

    I will summarize that.. :)
    Huihihi~ :D

    hinomotoblade

    • Seasoned Programmer
    • ***
    • Posts: 131
    • Flash Never Die :D
      • View Profile
    Ups done :D

    Actually the Script cant separate with the id Component..

    So if you want to make Mxml Component the id Component, Package Import and the Script must declare in one Component :D

    I dont know is that right?.. :P

    Thank you very much :)
    Huihihi~ :D

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    MXML files by itself are classes, but how you create and manage packages is up to you, in fact they are many frameworks that deals with this (Cairgorm, PureMVC, etc)

    Jorge