MACROMEDIA COLDFUSION MX 7.0.2-USING COLDFUSION MX WITH FLEX 2 Betriebsanweisung Seite 95

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 256
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 94
Using ActionScript in Flex applications 95
The following example declares a variable and a function:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
public var z:Number;
public function doSomething():void {
z = z + 1; // This must be in a function.
}
]]>
</mx:Script>
</mx:Application>
Using special characters in ActionScript
Special characters are any characters that might confuse the XML parser. The contents of
<mx:Script> tags are treated as XML by Flex, but Flex does not parse text in a CDATA
construct so that you can use XML-parsed characters such as angle brackets (< and >) and
ampersand (&). For example, the following script that includes a less than (<) comparison in
the for statement must be in a CDATA construct:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
public function changeText():void {
for (var i:int=1; i<10; i++) {
ta1.text += "Hello world\n";
}
}
]]>
</mx:Script>
<mx:TextArea id="ta1" width="100" height="300"/>
<mx:Button id="b1" label="Click Me" click="changeText()"/>
</mx:Application>
Seitenansicht 94
1 2 ... 90 91 92 93 94 95 96 97 98 99 100 ... 255 256

Kommentare zu diesen Handbüchern

Keine Kommentare