Comunidad de diseño web y desarrollo en internet online

Migrando AS2 a AS3 Ayuda!! (Parte 2)

Citar            
MensajeEscrito el 13 Abr 2011 10:06 pm
tengo la plantilla de una pagina en as2 y estoy pasandola a as3.El problema que tengo es que no entiendo mucho AS2 , siempre hice cosas con el 3 y no entiendo como reemplazar el codigo del 2 porque no se bien lo que hace.Algunas cosas se como se resuelven, pero otras no.El mayor incoveniente lo tengo con el LoadMovieNum y la carga en fotogramas especificos.Les dejo el codigo de 2 swf que se comunican entre si.



Main.fla ( codigo en frame 3])

Código ActionScript :

function LoadFirstMovie()
{
    var _loc1 = main_menu.btn0._name;
    firstMovie = _loc1.substring(3, 5);
    loadMovieNum(movies[firstMovie], 2);
} // End of the function
 
function btnOver()
{
    this.gotoAndPlay(2);
} // End of the function

function btnOut()
{
    this.gotoAndPlay(11);
} // End of the function

function btnReleased()
{
// clearintervarl no se lo que hace
    clearInterval(_global.myInterval);
    if (main_menu.btn0.enabled == false)
    {
        main_menu.btn0.gotoAndPlay(10);
        main_menu.btn0.enabled = true;
    } // end if
    if (Selected_Old)
    {
        with (Selected_Old)
        {
            enabled = true;
            gotoAndPlay(10);
        } // End of with
    } // end if
    this.enabled = false;
    Selected_Old = this;
    var currentBtn = this._name;
// substring (3,5)?
    currentMovie = currentBtn.substring(3, 5);
    var myTween1 = new mx.transitions.Tween(_level2, "_y", mx.transitions.easing.Strong.easeIn, _level2._y, -Stage.height, 6.000000E-001, true);
    myTween1.onMotionFinished = function ()
    {
        / como hago esto con loader?
       loadMovieNum(movies[currentMovie], 2);
    };
} // End of the function



attachMovie("taps", "trick_alpha", 1);
flscr_2_btn._visible = false;
startPosY = 5;
startPosX = 110;
var spacing = 0;
var firstMovie;
var MainMenuXml = new XML();
MainMenuXml.ignoreWhite = true;
var movies = new Array();
var names = new Array();
var loadXMLS = new Array();



MainMenuXml.onLoad = function (status)
{
    if (status)
    {
        var _loc2 = this.firstChild.childNodes[0].childNodes;
        for (i = 0; i < _loc2.length; i++)
        {
            names.push(_loc2[i].childNodes[0].firstChild.nodeValue);
            movies.push(_loc2[i].childNodes[1].firstChild.nodeValue);
            loadXMLS.push(_loc2[i].childNodes[2].firstChild.nodeValue);
            main_menu.attachMovie("button", "btn" + i, main_menu.getNextHighestDepth());
            logo = this.firstChild.childNodes[1].firstChild.nodeValue;
            logoX = this.firstChild.childNodes[2].firstChild.nodeValue;
            logoY = this.firstChild.childNodes[3].firstChild.nodeValue;
            copyright = this.firstChild.childNodes[4].firstChild.nodeValue;
            mainBtnX = this.firstChild.childNodes[5].firstChild.nodeValue;
            mainBtnY = this.firstChild.childNodes[6].firstChild.nodeValue;
            settingsVisible = this.firstChild.childNodes[7].attributes.settingsVisible;
            mainBtnNormal = this.firstChild.childNodes[8].firstChild.nodeValue;
            mainBtnOver = this.firstChild.childNodes[9].firstChild.nodeValue;
            topRect = this.firstChild.childNodes[10].firstChild.nodeValue;
            botRect = this.firstChild.childNodes[11].firstChild.nodeValue;
            footerColor = this.firstChild.childNodes[12].firstChild.nodeValue;
            setExpandBg = this.firstChild.childNodes[13].firstChild.nodeValue;
            setExpandBtn = this.firstChild.childNodes[14].firstChild.nodeValue;
            fsStrokeNormal = this.firstChild.childNodes[15].firstChild.nodeValue;
            fsStrokeOver = this.firstChild.childNodes[16].firstChild.nodeValue;
            fs2Normal = this.firstChild.childNodes[17].firstChild.nodeValue;
            fs2Over = this.firstChild.childNodes[18].firstChild.nodeValue;
            if (settingsVisible == "false")
            {
                settings_main._visible = false;
                settings_expand_final.settings_expand._visible = false;
                flscr_2_btn._visible = true;
            } // end if
            logoHolder._x = logoX;
            logoHolder._y = logoY;
            main_menu._x = mainBtnX;
            main_menu._y = mainBtnY;
            var _loc15 = new Color(main_menu["btn" + i].btn_txt_final.txt_btn_mc);
            _loc15.setRGB(mainBtnNormal);
            var _loc19 = new Color(main_menu["btn" + i].btn_txt_finalOver.txt_btn_mc);
            _loc19.setRGB(mainBtnOver);
            var _loc17 = new Color(menu_bg);
            _loc17.setRGB(topRect);
            var _loc13 = new Color(bar);
            _loc13.setRGB(botRect);
            var _loc12 = new Color(settings_expand_final.settings_expand);
            _loc12.setRGB(setExpandBtn);
            var _loc14 = new Color(copyright_mc);
            _loc14.setRGB(footerColor);
            var _loc9 = new Color(settings_main.settings_mc.settings_bg);
            _loc9.setRGB(setExpandBg);
            var _loc7 = new Color(settings_main.settings_mc.fullscreen_btn.c1.arrow_mc);
            _loc7.setRGB(fsArrowColor);
            var _loc4 = new Color(settings_main.settings_mc.fullscreen_btn.c2.arrow_mc);
            _loc4.setRGB(fsArrowColor);
            var _loc5 = new Color(settings_main.settings_mc.fullscreen_btn.c3.arrow_mc);
            _loc5.setRGB(fsArrowColor);
            var _loc6 = new Color(settings_main.settings_mc.fullscreen_btn.c4.arrow_mc);
            _loc6.setRGB(fsArrowColor);
            var _loc8 = new Color(settings_main.settings_mc.fullscreen_btn.fs_bg);
            _loc8.setRGB(0);
            var _loc16 = new Color(settings_main.settings_mc.fullscreen_btn.stroke_mc);
            _loc16.setRGB(fsStrokeNormal);
            var _loc18 = new Color(settings_main.settings_mc.fullscreen_btn.stroke_mcOver.stroke_fl);
            _loc18.setRGB(fsStrokeOver);
            var _loc10 = new Color(flscr_2_btn.fs2_normal);
            _loc10.setRGB(fs2Normal);
            var _loc11 = new Color(flscr_2_btn.fs2_over);
            _loc11.setRGB(fs2Over);
            var _loc3 = new MovieClipLoader();
            _loc3.loadClip(logo, logoHolder);
            _loc3.onLoadInit = function (target)
            {
                mx.transitions.TransitionManager.start(logoHolder, {type: mx.transitions.Fly, direction: mx.transitions.Transition.IN, duration: 1, easing: mx.transitions.easing.Strong.easeInOut, startPoint: 2});
            };
            copyright_mc.copyright_txt.text = copyright;
            main_menu["btn" + i].btn_txt_final.txt_btn_mc.nameTxt.autoSize = "left";
            main_menu["btn" + i].btn_txt_final.txt_btn_mc.nameTxt.text = names[i];
            main_menu["btn" + i].btn_txt_finalOver.txt_btn_mc.nameTxt.autoSize = "left";
            main_menu["btn" + i].btn_txt_finalOver.txt_btn_mc.nameTxt.text = names[i];
            main_menu["btn" + i]._y = startPosY;
            main_menu["btn" + i]._x = spacing;
            spacing = spacing + (main_menu["btn" + i]._width + 15);
            main_menu["btn" + i].onRollOver = btnOver;
            main_menu["btn" + i].onRollOut = main_menu["btn" + i].onReleaseOutside = btnOut;
            main_menu["btn" + i].onRelease = btnReleased;
            main_menu.btn0.gotoAndStop(10);
            main_menu.btn0.enabled = false;
            mx.transitions.TransitionManager.start(main_menu["btn" + i], {type: mx.transitions.Fade, direction: mx.transitions.Transition.IN, duration: 7.000000E-001, easing: mx.transitions.easing.Regular.easeOut});
            mx.transitions.TransitionManager.start(copyright_mc, {type: mx.transitions.Fade, direction: mx.transitions.Transition.IN, duration: 7.000000E-001, easing: mx.transitions.easing.Regular.easeOut});
            mx.transitions.TransitionManager.start(settings_expand_final, {type: mx.transitions.Fade, direction: mx.transitions.Transition.IN, duration: 7.000000E-001, easing: mx.transitions.easing.Regular.easeOut});
            mx.transitions.TransitionManager.start(menu_bg, {type: mx.transitions.Wipe, direction: mx.transitions.Transition.IN, duration: 1, easing: mx.transitions.easing.Strong.easeInOut, startPoint: 2});
            mx.transitions.TransitionManager.start(bar, {type: mx.transitions.Wipe, direction: mx.transitions.Transition.IN, duration: 1, easing: mx.transitions.easing.Strong.easeInOut, startPoint: 8});
        } // end of for
        LoadFirstMovie();
    }
    else
    {
        trace ("no XML specified for menu");
    } // end else if
};



MainMenuXml.load("MAIN/main_menu.xml");
var Selected_Old = null;
var currentMovie;
flscr_2_btn.fs2_btn.onRelease = function ()
{
    if(Stage["displayState"]=="normal")
   
    {
      Stage["displayState"]=="fullScreen";
    }
    else
    {
        Stage["displayState"]=="normal";
    } // end else if
};


// esto se como pasarlo
flscr_2_btn.fs2_btn.onRollOver = function ()
{
    flscr_2_btn.fs2_over._visible = true;
    flscr_2_btn.fs2_normal._visible = false;
};


// esto se como pasarlo
flscr_2_btn.fs2_btn.onRollOut = flscr_2_btn.fs2_btn.onReleaseOutside = function ()
{
    flscr_2_btn.fs2_over._visible = false;
    flscr_2_btn.fs2_normal._visible = true;
};


// esto se como pasarlo
settings_main.settings_mc.fullscreen_btn.onRelease = function ()
{
    if(Stage["displayState"]=="normal")
    {
        Stage["displayState"]= "fullScreen";
    }
    else
    {
        Stage["displayState"] = "normal";
    } // end else if
};


//como hago para reproducir " overSmall" en as3
settings_main.settings_mc.fullscreen_btn.onRollOver = function ()
{
    if(Stage["displayState"]=="normal")
    {
        this.gotoAndPlay("overSmall");
    }
    else
    {
        this.gotoAndPlay("overFull");
    } // end else if
};



settings_main.settings_mc.fullscreen_btn.onRollOut = settings_main.settings_mc.fullscreen_btn.onReleaseOutside = function ()
{
    if(Stage["displayState"]=="normal")
    {
        this.gotoAndPlay("outSmall");
    }
    else
    {
        this.gotoAndPlay("outFull");
    } // end else if
};






Bueno, cuando lo compilo en as3 da error geom color y un par de cosas mas que ya se como pasar , lo que no tengo idea es como cargar los mc en fotogramas especificos.SI alguien me ayuda o necesita que suba el segundo archivo me dice

Por italpark

8 de clabLevel



 

chrome
Citar            
MensajeEscrito el 13 Abr 2011 11:38 pm
que parte no entedes?

Por voices

43 de clabLevel



 

firefox
Citar            
MensajeEscrito el 13 Abr 2011 11:52 pm
es necesario que nos digas cual es el problema asi poniendo todo el codigo no podremos como ayudarte

saludos cordiales

Por joshuavw

Claber

306 de clabLevel



Genero:Masculino  

Juego, aprendo y programo

firefox
Citar            
MensajeEscrito el 14 Abr 2011 12:02 am

Código ActionScript :

//como hago para reproducir " overSmall" en as3 
settings_main.settings_mc.fullscreen_btn.onRollOver = function () 
{ 
    if(Stage["displayState"]=="normal") 
    { 
        this.gotoAndPlay("overSmall"); 
    } 
    else 
    { 
        this.gotoAndPlay("overFull"); 
    } // end else if 
}; 


haciendo una suposicion, settings_main es un movieclip, que contiene a settings_mc (otro MC) que a su vez contiene a fullscreen_btn (supongo que es un MC tambien)

a ese boton se le agrega un "listener" para el evento ROLL_OVER (en AS3)

otra suposicion, es que

Código ActionScript :

Stage["displayState"]


se refiere a checkear si actualmente esta o no en pantalla completa.

y

Código ActionScript :

 this.gotoAndPlay("overSmall"); 


es enviar al MC fullscreen_btn al frame "overSmall" en el cual tiene una animacion que corresponde a que la pantalla esta en modo no fullscreen (por ejemplo flechitas que se abren hacia afuera) y "overFull" es animacion para cuando el boton esta en modo fullscreen

Por voices

43 de clabLevel



 

firefox
Citar            
MensajeEscrito el 14 Abr 2011 08:54 am
gracias a todos, es un lio, al final no se como voy a soluccionar todo, mañana pruebo y comento

Por italpark

8 de clabLevel



 

firefox
Citar            
MensajeEscrito el 14 Abr 2011 01:40 pm
tal vez seria mas facil decirnos que es lo que queres hacer (¿una galeria que carga desde XML?) y escribirlo desde cero en AS3, ya que la arquitectura y diseño de codigo de AS2 es muy distinta a la de AS3.

Saludos

Por voices

43 de clabLevel



 

firefox
Citar            
MensajeEscrito el 18 Abr 2011 06:54 pm
Nono no es una galería, el script que subí pertenece al main de un template de una pagina completa en as2 que tengo hace mucho.
Solo subí el main porque los demas fla son faciles de pasar.

Por italpark

8 de clabLevel



 

chrome

 

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