Comunidad de diseño web y desarrollo en internet online

Llamar swf desde xml con AS?

Citar            
MensajeEscrito el 07 Nov 2007 01:37 pm
Hola!
Tengo un menú en flash que llama todo lo que está en un xml, mediante un AS, quiere que al hacer click en alguno de las imágenes me llame un swf

Les paso el AS y el XML
AS:

Código :

import mx.utils.Delegate;
import mx.transitions.Tween;
import mx.transitions.easing.*;

var numOfItems:Number;
var radiusX:Number = 300;
var radiusY:Number = 75;
var centerX:Number = Stage.width / 2;
var centerY:Number = Stage.height / 2;
var speed:Number = 0.05;
var perspective:Number = 130;
var home:MovieClip = this;
theText._alpha = 0;

var tooltip:MovieClip = this.attachMovie("tooltip","tooltip",10000);
tooltip._alpha = 0;

var xml:XML = new XML();
xml.ignoreWhite = true;

xml.onLoad = function()
{
   var nodes = this.firstChild.childNodes;
   numOfItems = nodes.length;
   for(var i=0;i<numOfItems;i++)
   {
      var t = home.attachMovie("item","item"+i,i+1);
      t.angle = i * ((Math.PI*2)/numOfItems);
      t.onEnterFrame = mover;
      t.toolText = nodes[i].attributes.tooltip;
      t.content = nodes[i].attributes.content;
      t.icon.inner.loadMovie(nodes[i].attributes.image);
      t.r.inner.loadMovie(nodes[i].attributes.image);
      t.icon.onRollOver = over;
      t.icon.onRollOut = out;
      t.icon.onRelease = released;
   }
}

function over()
{
   //BONUS Section
   var sou:Sound = new Sound();
   sou.attachSound("sover");
   sou.start();
   
   home.tooltip.tipText.text = this._parent.toolText;
   home.tooltip._x = this._parent._x;
   home.tooltip._y = this._parent._y - this._parent._height/2;
   home.tooltip.onEnterFrame = Delegate.create(this,moveTip);
   home.tooltip._alpha = 100;
}

function out()
{
   delete home.tooltip.onEnterFrame;
   home.tooltip._alpha = 0;
}

function released()
{
   //BONUS Section
   var sou:Sound = new Sound();
   sou.attachSound("sdown");
   sou.start();
   
   home.tooltip._alpha = 0;
   for(var i=0;i<numOfItems;i++)
   {
      var t:MovieClip = home["item"+i];
      t.xPos = t._x;
      t.yPos = t._y;
      t.theScale = t._xscale;
      delete t.icon.onRollOver;
      delete t.icon.onRollOut;
      delete t.icon.onRelease;
      delete t.onEnterFrame;
      if(t != this._parent)
      {
         var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,t._xscale,0,1,true);
         var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,t._yscale,0,1,true);
         var tw3:Tween = new Tween(t,"_alpha",Strong.easeOut,100,0,1,true);
      }
      else
      {
         var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,t._xscale,100,1,true);
         var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,t._yscale,100,1,true);
         var tw3:Tween = new Tween(t,"_x",Strong.easeOut,t._x,200,1,true);
         var tw4:Tween = new Tween(t,"_y",Strong.easeOut,t._y,320,1,true);
         var tw5:Tween = new Tween(theText,"_alpha",Strong.easeOut,0,100,1,true);
         theText.text = t.content;
         var s:Object = this;
         tw.onMotionStopped = function()
         {
            s.onRelease = unReleased;
         }
      }
   }
}

function unReleased()
{
   //BONUS Section
   var sou:Sound = new Sound();
   sou.attachSound("sdown");
   sou.start();
   
   delete this.onRelease;
   var tw:Tween = new Tween(theText,"_alpha",Strong.easeOut,100,0,0.5,true);
   for(var i=0;i<numOfItems;i++)
   {
      var t:MovieClip = home["item"+i];
      if(t != this._parent)
      {
         var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,0,t.theScale,1,true);
         var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,0,t.theScale,1,true);
         var tw3:Tween = new Tween(t,"_alpha",Strong.easeOut,0,100,1,true);
      }
      else
      {
         var tw:Tween = new Tween(t,"_xscale",Strong.easeOut,100,t.theScale,1,true);
         var tw2:Tween = new Tween(t,"_yscale",Strong.easeOut,100,t.theScale,1,true);
         var tw3:Tween = new Tween(t,"_x",Strong.easeOut,t._x,t.xPos,1,true);
         var tw4:Tween = new Tween(t,"_y",Strong.easeOut,t._y,t.yPos,1,true);
         tw.onMotionStopped = function()
         {
            for(var i=0;i<numOfItems;i++)
            {
               var t:MovieClip = home["item"+i];
               t.icon.onRollOver = Delegate.create(t.icon,over);
               t.icon.onRollOut = Delegate.create(t.icon,out);
               t.icon.onRelease = Delegate.create(t.icon,released);
               t.onEnterFrame = mover;
            }
         }
      }
   }
}


function moveTip()
{
   home.tooltip._x = this._parent._x;
   home.tooltip._y = this._parent._y - this._parent._height/2;
}

xml.load("icons.xml");

function mover()
{
   this._x = Math.cos(this.angle) * radiusX + centerX;
   this._y = Math.sin(this.angle) * radiusY + centerY;
   var s = (this._y - perspective) /(centerY+radiusY-perspective);
   this._xscale = this._yscale = s*100;
   this.angle += this._parent.speed;
   this.swapDepths(Math.round(this._xscale) + 100);
}

this.onMouseMove = function()
{
   speed = (this._xmouse-centerX)/2500;
}


xml:

Código :

<icons>
<icon image="images/paso_01.jpg" tooltip="Paso 1" content="solo texto" swf="images/gc.swf"  />
<icon image="images/paso_02.jpg" tooltip="Paso 2"  swf="images/gc.swf"  content="solo texto" />
<icon image="images/paso_03.jpg" tooltip="Paso 3"  swf="images/gc.swf"   content="solo texto" />
<icon image="images/paso_04.jpg" tooltip="Paso 4"    content="solo texto" />
</icons>

Por paulan

7 de clabLevel



 

firefox
Citar            
MensajeEscrito el 09 Nov 2007 12:16 am
:O es muucho codigo desconocido para mi, en si cual es la ventaja o aplicacion de este metodo de comunicacion entre flash xml y php?

Por Mike§ilver

83 de clabLevel



 

msie7
Citar            
MensajeEscrito el 31 Mar 2008 08:32 pm
Bueno para mi no es desconocido,....es el codigo del carrusel de gotoandlearn,....

Por alejandrommb

16 de clabLevel



Genero:Masculino  

Lima, Peru

msie7
Citar            
MensajeEscrito el 26 Abr 2008 07:24 pm
Mas alla del codigo que es claro que es el de carousel, como se hace lo que indica el amigo ?

Por hakanuvi

0 de clabLevel



Genero:Masculino  

msie7
Citar            
MensajeEscrito el 27 Jul 2010 05:29 pm
Bueno, alguien sabe? tmb me gustaría saber cómo please!! :D

Por quesadillasypulke

0 de clabLevel



 

firefox
Citar            
MensajeEscrito el 19 Ago 2010 07:18 pm
Este foro es de AS3 y esto está en AS2... :S

Por Naujfract

124 de clabLevel



 

Bogotá Colombia

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.