Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>EDITED:</strong></p> <p>Sorry I did not look carefully at your question. </p> <p>Your problem is that the *.as file does not know what your components are:</p> <p>You need to pass the components to the function like so:</p> <pre><code>public function checkCode(txtToegangscode:TextInput, lblFeedback:Label):void{ if (txtToegangscode.text == "moia") { lblFeedback.text = "ok"; txtToegangscode.enabled = false; btnGaNaarPersonen.visible = true; btnGaVerder.visible = false; } else { lblFeedback.text = "wrong"; } </code></pre> <p>This will allow your *.as file to access the properties in those components.</p> <p><strong>OLD:</strong></p> <p>Here is the documentation: <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=usingas_4.html" rel="nofollow">http://livedocs.adobe.com/flex/3/html/help.html?content=usingas_4.html</a></p> <p>You use the source attribute of the tag to include external ActionScript files in your Flex applications. This provides a way to make your MXML files less cluttered and promotes code reuse across different applications.</p> <p>Do not give the script file the same name as the application file. This causes a compiler error.</p> <p>The following example shows the contents of the IncludedFile.as file:</p> <pre><code>// usingas/includes/IncludedFile.as public function computeSum(a:Number, b:Number):Number { return a + b; } </code></pre> <p>The following example imports the contents of the IncludedFile.as file. This file is located in the includes subdirectory.</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;!-- usingas/SourceInclude.mxml --&gt; &lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"&gt; &lt;mx:Script source="includes/IncludedFile.as"/&gt; &lt;mx:TextInput id="ta1st" text="3" width="40" x="170" y="24" textAlign="right"/&gt; &lt;mx:TextInput id="ta2nd" text="3" width="40" x="170" y="52" textAlign="right"/&gt; &lt;mx:TextArea id="taMain" height="25" width="78" x="132" y="82" textAlign="right"/&gt; &lt;mx:Button id="b1" label="Compute Sum" click="taMain.text=String(computeSum(Number(ta1st.text), Number(ta2nd.text)));" x="105" y="115" /&gt; &lt;mx:Label x="148" y="52" text="+" fontWeight="bold" fontSize="17" width="23"/&gt; &lt;/mx:Application&gt; </code></pre> <p>The source attribute of the tag supports both relative and absolute paths.</p> <p>The source attribute of the tag and the include directive refer to files in different ways.</p> <p>The following are the valid paths to external files that are referenced in an tag's source attribute:</p> <p>Relative URLs, such as ../myscript.as. A relative URL that does not start with a slash is resolved relative to the file that uses it. If the tag is included in "mysite/myfiles/myapp.mxml," the system searches for "mysite/IncludedFile.as".</p> <p>For an ActionScript include directive, you can reference only relative URLs. Flex searches the source path for imported classes and packages. Flex does not search the source path for files that are included using the include directive or the source attribute of the tag. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload