CS174
Chris Pollett
Nov. 29, 2010
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" > <mx:Button label="Hello World Button"></mx:Button> </mx:Application>
This could then be compiled by typing:
mxmlc test.mxml
This should produce a test.swf file.
<html> <body> <object type="application/x-shockwave-flash" data="test.swf" width="320" height="240"> <param name="src" value="test.swf" /> <!-- name="movie" works as well --> </object> </body> </html>
<?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" > <mx:Button label="Hello World Button"></mx:Button> </mx:WindowedApplication>
amxmlc test.mxml
<?xml version="1.0" encoding="utf-8" standalone="no" ?> <application xmlns="http://ns.adobe.com/air/application/1.5"> <id>org.pollett.CS174Fall2008.HelloWorld</id> <filename>test2</filename> <version>1.0</version> <initialWindow> <title>Hello World Example</title> <content>test2.swf</content> <visible>true</visible> </initialWindow> </application>
adl test2-app.xml
adt -certificate -cn ChrisPollett 1024-RSA mytest.p12 secretsecret here is the password being used.
adt -package -storetype pkcs12 -keystore mytest.p12 \ test2.air test2-app.xml test2.swf
Which of the following statements is true?
<mx:VBox> <mx:Button label="Button 1" /> <mx:Button label="Button 2" /> </mx:VBox>
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" > <mx:VBox> <mx:HBox> <mx:Button> <mx:label>Button 1</mx:label></mx:Button> <mx:Button label="Button 2" /> </mx:HBox> <mx:ComboBox> <mx:dataProvider> <mx:ArrayCollection> <mx:String>Item 1</mx:String> <mx:String>Item 2</mx:String> <mx:String>Item 3</mx:String> </mx:ArrayCollection> </mx:dataProvider> </mx:ComboBox> <mx:Text text="hello" width="100" height="15" /> <mx:Text text="{input.text}" width="150" height="20" /> <mx:TextInput id="input" /> </mx:VBox> </mx:Application>
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" > <!-- styles can be used with Flex (notice html style comment) --> <mx:Style> /* C style comment */ .red { color: red; } </mx:Style> <mx:VBox> <mx:TextArea> <mx:text>This is some text.</mx:text></mx:TextArea> <mx:TextArea width="400" height="100"> <mx:htmlText><![CDATA[This is a test <b>with html </b>.]]></mx:htmlText> </mx:TextArea> <mx:Button label="Button" styleName="red" /> </mx:VBox> </mx:Application>
<mx:Text id="out" text="{'the output is:' + someid.text}" />
<mx:Script src="my_script.as" />
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="200" height="200" > <mx:Script> function imclicked() { var a = 30; mx.controls.Alert.show('The world needs more lerts '+a); /*since this function does not specify types and say what package it is in, it will generate warnings */ } </mx:Script> <mx:Style> Canvas { background-color:red; } </mx:Style> <mx:Canvas width="150" height="150"> <!--Notice how you can use a Canvas layout for positioning --> <mx:Button id="bealert1" x="20" y="30" label="Be A Lert 1" click="mx.controls.Alert.show('The world needs more lerts'); " /> <mx:Button id="bealert2" left="10" bottom="40"> <!--right and bottom based on parent container --> <mx:label>Be A Lert 2</mx:label> <mx:click>imclicked(); </mx:click> </mx:Button> </mx:Canvas> </mx:Application>
package my_package { import some_package; //a list of packages public class MyClass extends Something { // some var declarations public function MyClass(){} //constructor /* other methods which could be static, public, private, protected (available to subclass), internal (available within package)*/ } }
var my_variable:Number;
internal function my_method(my_arg:int) : uint {/* body */}
button.addEventListener(MouseEvent.CLICK, clickHandler) function clickHandler(evt:MouseEvent):void {/*code */} button.removeEventListener(MouseEvent.CLICK clickHandler);
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="400" initialize="init()" > <mx:Script> <![CDATA[ [Embed(source="me3.jpg")] /* this add me3.jpg directly into the .swf file that will be produced other two images below come from external files */ private var meAsset:Class; //will represent image file above private function init():void { me3.source = meAsset; } ]]> </mx:Script> <mx:HBox> <mx:Image source="me1.jpg" width="150" height="150"/> <!-- need to use webserver not local filesystem --> <mx:Image id="me3" width="150" height="150"/> </mx:HBox> <mx:Image id="image2" autoLoad="false" width="150" height="150" /> <mx:Button label="Load Image" click="image2.load('me2.jpg');" /> </mx:Application>
<?xml version="1.0" encoding="utf-8" ?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="400" > <mx:Panel title="My Video" > <mx:VideoDisplay id="myViewer" source="fred_ott.flv" volume="{volumeControl.value}" /> <!-- note the source is an http source; trouble if play on filesystem --> <!-- you should look up Fred Ott --> <!-- you can create .flv files using ffmeg (Mac, Linux, Windows). Or google for your favorite other tool. --> <mx:Label text="{myViewer.playheadTime.toPrecision(2)}" /> <mx:ControlBar> <mx:Button label="Play" click="myViewer.play();" /> <mx:Button label="Pause" click="myViewer.pause();" /> <mx:Button label="Stop" click="myViewer.stop();" /> <mx:HSlider id="volumeControl" maximum="1" width="80" /> </mx:ControlBar> </mx:Panel> </mx:Application>