Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/12/2009, 22:18
Avatar de TMeister
TMeister
Crazy Coder
 
Fecha de Ingreso: enero-2002
Ubicación: En la Oficina
Mensajes: 2.880
Antigüedad: 22 años, 5 meses
Puntos: 193
Respuesta: Modificar propiedades de componentes

Usando propiedades publicas.

Main

Código XML:
Ver original
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*">
  3.  
  4.     <mx:Script>
  5.         <![CDATA[
  6.             protected function show():void
  7.             {
  8.                 component.showProps();
  9.             }
  10.         ]]>
  11.     </mx:Script>
  12.    
  13.     <local:some prop1="String" prop2="10" id="component" />
  14.     <mx:Button click="show()" label="Show data" horizontalCenter="0" verticalCenter="0" />
  15.  
  16. </mx:Application>

component
Código XML:
Ver original
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
  3.     <mx:Script>
  4.         <![CDATA[
  5.             import mx.controls.Alert;
  6.            
  7.             public var prop1:String;
  8.             public var prop2:Number;
  9.            
  10.             public function showProps():void
  11.             {
  12.                 Alert.show("prop1="+ prop1+" prop2="+prop2);
  13.             }
  14.         ]]>
  15.     </mx:Script>
  16. </mx:Canvas>