PDA

View Full Version : Help me with Action Script 3?



kool_kat_os
March 6th, 2008, 03:23 AM
I am playing around with Adobe Flash CS3 and i am writing a simple Action Script...

here is the code:


import fl.events.*;
import flash.events.*;
import fl.data.DataProvider;

var dp1:DataProvider = new DataProvider();
dp1.addItem( { label: "test item 1" } );
dp1.addItem( { label: "test item 2" } );
dp1.addItem( { label: "test item 3" } );
dp1.addItem( { label: "test item 4" } );
dp1.addItem( { label: "test item 5" } );
dp1.addItem( { label: "test item 6" } );

List1.dataProvider = dp1;

List1.addEventListener(Event.CHANGE, announceSelect);
Button1.addEventListener(MouseEvent.CLICK, deleteItem);
Button2.addEventListener(MouseEvent.CLICK, duplicateItem);

function announceSelect(e:Event):void {
trace("You have selected item: " + List1.selectedItem.label);
}
function deleteItem(e:MouseEvent):void {
trace("You have removed item: " + List1.selectedItem.label);
dp1.removeItem(List1.selectedItem);
}
function duplicateItem(e:MouseEvent):void {
trace("You have duplicated item: " + List1.selectedItem.label);
dp1.addItem(List1.selectedItem);
}

how do i make it so that a form can be used and you can add stuff from the form to the list???
(google didnt help)

i dont know if this question makes sense...

EDIT: should i devote my time to learning c++ or Action Script 3?

Acglaphotis
March 6th, 2008, 03:38 AM
I'd say python, because the syntax is not too different from actionscripts and its a good start to programming : D.

kool_kat_os
March 6th, 2008, 04:10 AM
I'd say python, because the syntax is not too different from actionscripts and its a good start to programming : D.

if programming is the way to go...then im sticking with c++