ActionScript 保萨

this.createEmptyMovieClip("timer",50);
timer.onEnterFrame = function()
{
        if (this.startTime>0)
        {
                var diff = getTimer()-this.startTime;
                if (diff>this.timerLength)
                {
                        this.target.play();
                        this.startTime = 0;
                }
        }
};
function pauseFor(theTime)
{
        stop();
        timer.timerLength = (theTime*1000);
        timer.startTime = getTimer();
        timer.target = this;
}

ActionScript cargador xml

function cargar_xml(nombre) {
 xm_preguntas = new XML();
 xm_preguntas.ignoreWhite = true;
 xm_preguntas.load("xml/"+nombre+".xml");
 xm_preguntas.onLoad = function(success) {
  if (success) {
   trace("ok xml "+nombre);
  } else {
   trace("fallo xml " + nombre);
  }
 };
}
//----------------------------------------------
cargar_xml("preguntas")

ActionScript domina quien viene al frente swapDepths

1.- En este ejemplo he creado 4 clips de película

2.- En el primer fotograma de la línea de tiempo principal declaramos una variable "x"

   1. var x=0

3.- En cada uno de los clips de película les asignamos el siguiente Actionscript


   1. //Al presionar comenzamos a arrastrar el clip
   2. on (press) {
   3.       startDrag(this);
   4. }
   5. //Al liberar dejamos de arrastrar el clip
   6. on (release) {
   7.       stopDrag();
   8. }
   9. //Al presionar o liberar
  10. on (press, release) {
  11.       _root.x +=1; //Incrementamos el valor de la variable en 1
  12.       this.swapDepths(_root.x); //Le asignamos como nivel de apilamiento
  13.       //el valor de la variable
  14. }

ActionScript Precargador dinamico适应性强

stop();
//Alexis Garrido
//Web Developer
onEnterFrame = function () {
var r = Math.round((getBytesLoaded()/getBytesTotal())*100);
cor_y = Stage.height/2;
cor_x = Stage.width/2;
this.createTextField("carga", 102, cor_x-41, cor_y-2.6, 100, 20);
this.createEmptyMovieClip("barra", 100);
barra.beginFill(0xFFFFFF);
barra.moveTo(0, 0);
barra.lineTo(200, 0);
barra.lineTo(200, 10);
barra.lineTo(0, 10);
barra.lineTo(0, 0);
barra.endFill();
this.createEmptyMovieClip("des", 101);
des.beginFill(0xCCCCCC);
des.moveTo(0, 0);
des.lineTo(200, 0);
des.lineTo(200, 10);
des.lineTo(0, 10);
des.lineTo(0, 0);
des.endFill();
des._x = cor_x-105;
des._y = cor_y;
des._xscale = r;
barra._x = cor_x-105;
barra._y = cor_y;
barra._xscale = 100;
var formato:TextFormat = new TextFormat();
formato.color = 0x000000;
formato.bold = true;
formato.size = 10;
formato.font = "Arial";
carga.text = "Cargando "+r+"%";
carga.setTextFormat(formato);
if (r == 100) {
delete onEnterFrame;
carga._visible = 0;
barra._visible = 0;
des._visible = 0;
play();
}
};

ActionScript Campo Input de texto con fuente especial

var formaFont2 = new TextFormat();
formaFont2.color = 0x000000;
formaFont2.font = "F_carpetes";
formaFont2.size = 10;

this.createTextField("txt_nom_projecte", 33, 235, 320, 82, 16);
txt_nom_projecte.wordWrap = true;
txt_nom_projecte.autoSize = true;
txt_nom_projecte.embedFonts = true;
txt_nom_projecte.type = "input";
txt_nom_projecte.border = true;
txt_nom_projecte.text = "Texto de prueba";

txt_nom_projecte.setNewTextFormat(formaFont2);

ActionScript 动作脚本

I am looking for an actionscript crawler. I always need to go thru all the lines of code to find instance names and its linkage. Let me know of any good software for this purpose. I hate eclipse. I am a Mac. Let me know@.

ActionScript LoadVars.sendAndLoad w / XML响应

var replyXML = new XML();
replyXML.onLoad = myOnLoad;
function myOnLoad(success)
{
if (success) {
trace(replyXML);
} else {
trace('fail');
}
}

var send_lv = new LoadVars();
send_lv.postVar = "foo";
send_lv.sendAndLoad("addressOfMyWebServiceOrOtherProgram", replyXML, "POST");

ActionScript 按钮行为

stop ();

this.onEnterFrame = function(){ 
if(rewind == true){ 
prevFrame(); 
} 
} 

this.onRollOver = function(){ 
rewind = false; 
play(); 
} 

this.onRollOut = function(){ 
rewind = true; 
} 

this.onRelease = function(){ 
getURL("http://www.flashvault.net"); 
}

ActionScript fillBackground

	/**
	 * Fills a supplied MovieClip with a specific width, height, color, and opacity
	*/
	private function fillBackground(_obj:MovieClip, _w:Number, _h:Number, _color, _opacity:Number):Void
	{
		_obj.beginFill( _color, _opacity );
		_obj.moveTo(0, 0);
		_obj.lineTo(_w, 0);
		_obj.lineTo(_w, _h);
		_obj.lineTo(0, _h);
		_obj.lineTo(0, 0);
		_obj.endFill();
	};

ActionScript 从外部接口调用JavaScript

import flash.external.*;
ExternalInterface.call("makePopup('mylink.html','My Link','750','475')");