Funciones

8
funcione s Nombre: Andrés Felipe Díaz Jojoa 11 COMPUTACION

Transcript of Funciones

Page 1: Funciones

funciones

Nombre: Andrés Felipe Díaz Jojoa11 COMPUTACION

Page 2: Funciones

Y vamos aplicando a ejemplo como este:

function ContarHastaDiez():void{ for (var 1=0;1<10;1++){

trace (i); }}

ContarHastaDiez

Page 3: Funciones

var nombre:String=“felipe ";var apellido:String=“jojoa";function nombreCompleto() : String{

if(!nombre ||!apellido){return ""; }

var miNombre:String=nombre+" "+apellido;return miNombre;

}var usuario :String=nombreCompleto();trace (usuario);

Page 4: Funciones

Crear gráficos en flash por medio de código

this.graphics.lineStyle(6,0x00ff99);this.graphics.moveTo(200,100);

this.graphics.lineTo(300,250)

this.graphics.lineStyle(5,0x3456ff559);

this.graphics.curveTo(100,100,30,200);

códigoejecución

Page 5: Funciones

this.graphics.lineStyle(6,0x00ff99);this.graphics.moveTo(200,100);

this.graphics.lineTo(300,250)

this.graphics.lineStyle(5,0x3456ff559);this.graphics.curveTo(00,350,30,200);this.graphics.drawRect(300,30,60,90);this.graphics.drawCircle(350,260,70);

this.graphics.beginFill(0x000030);this.graphics.drawEllipse(360,100,100,

30)this.graphics.endFill();

this.graphics.drawCircle(150,260,70);

ejecución

código

Page 6: Funciones

import flash.text.TextField;var texto:TextField=new TextField();

texto.text="aqui tenemos un ejemplo de como emplear texto con codigo en flash";

texto.x=120;texto.y=200;

texto.width=350;addChild(texto);

Texto en flash

código

ejecución

Page 7: Funciones

import flash.text.TextField;var miFormato:TextFormat=new

TextFormat();miFormato.bold=true;

miFormato.font="arial";miFormato.size=30;

miFormato.color=0x000ab;var texto:TextField=new TextField();

texto.text="te quieroo muchop ";texto.x=50;texto.y=50;

texto.width=350;texto.border=true

texto.setTextFormat(miFormato);addChild(texto);

crear hipervinculosimport flash.text.TextField;

var miEnlaceWeb:TextField=new TextField();miEnlaceWeb.htmlText="visita a <A

HREF='http://www.iemoraosejo.edu.co'>luis eduardo mora osejo";

miEnlaceWeb.width=260;addChild (miEnlaceWeb)

import flash.text.StyleSheet;var hojita:StyleSheet=new StyleSheet();

hojita.setStyle("A",{(textDecoration:"underline",color:"#0000ff"var miEnlaceWeb:TextField=new TextField();

miEnlaceWeb.styleSheet=hojita;

ejecución

Page 8: Funciones

var spritel:Sprite=new Sprite();spritel.graphics.lineStyle(6,0xff9900);

spritel.graphics.drawRect(0,0,250,250);addChild(spritel);

spritel.y=50;addChild(sprite2);var sprite3:Sprite=new Sprite();sprite3.graphics.lineStyle(2,0xfffff);sprite3.graphics.beginFill(0xcccc00);sprite3.graphics.drawCircle(0,0,25);spritel.x=125;spritel.y=125;addChild(sprite3);al dar clic

var sprite3:Sprite=new Sprite();sprite3.graphics.lineStyle(2,0xfffff);sprite3.graphics.beginFill(0xcccc00);sprite3.graphics.drawCircle(0,0,25);spritel.x=125;spritel.y=125;addChild(sprite3);sprite1.addEventListener(MouseEvent.CLICK,pulsarsprite);sprite2.addEventListener(MouseEvent.CLICK,pulsarsprite);function pulsarsprite(Event:MouseEvent){

event.currentTarget.addChild(sprite3);}