Flash Gallery | Flash Templates | Flash Menu | Flash Design | Flash Audio & Video

Video Corsi Actionscript 3.0


+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 10 of 13

Thread: problema swapChild clip in rotazione

  1. #1
    Moderator Moving My Stuff To The FlepStudio tem is on a distinguished road tem's Avatar
    Join Date
    Jan 1970
    Posts
    639
    Rep Power
    41

    problema swapChild clip in rotazione

    amazing Flash templates
    Ciao a tutti!

    stavo provando a portare questo script in as3..
    Menu 3D rotatorio « JuliusDesign

    non sono riuscito a gestire lo swapChild dei clip..

    la situazione è questa:
    menu

    è da un pò che sono ad un punto morto.. help!!

    ecco il codice per il movimento:

    Code:
    var radiusX:Number = 300;
    var radiusY:Number = 75;
    
    //stage width/2
    var centerX:Number = 680 / 2;
    //stage height/2
    var centerY:Number = 415 / 2;
    
    var speed:Number = 0.05;
    var perspective:Number = 130;
    
    
    private function mover(e:Event):void
    		{
    			e.target.x = Math.cos(e.target.angle) * radiusX + centerX;
    			e.target.y = Math.sin(e.target.angle) * radiusY + centerY;
    			var s = (e.target.y + perspective) /(centerY+radiusY-perspective);
    			e.target.scaleX = e.target.scaleY = s/3;
    			e.target.angle += speed/2;
    	
    	
    		}

  2. #2
    Administrator Living At The FlepStudio! Flep is on a distinguished road
    Join Date
    Jul 2007
    Posts
    5,457
    Rep Power
    8

    Re: problema swapChild clip in rotazione

    Ciao tem

    Io lo avevo fatto con AS 2.0 e lo devo ancora migrare.
    Ti lascio il codice così gli dai un' occhiata.
    Attached Files

  3. #3
    Moderator Moving My Stuff To The FlepStudio tem is on a distinguished road tem's Avatar
    Join Date
    Jan 1970
    Posts
    639
    Rep Power
    41

    Re: problema swapChild clip in rotazione

    Grazie Flep! =)
    mi studio bene il codice e provo a portarlo in as3..

    A prest'!

  4. #4
    Junior Member Settled In toni_1974 is on a distinguished road
    Join Date
    Oct 2007
    Posts
    15
    Rep Power
    0

    Riferimento: problema swapChild clip in rotazione

    Ciao TEM

    mi sono accorto solo ora di aver postato un post già postato da tem
    scusate.....

    cmq tem per caso sei riuscito a risolvere il problema?
    grazie molte

  5. #5
    Moderator Moving My Stuff To The FlepStudio tem is on a distinguished road tem's Avatar
    Join Date
    Jan 1970
    Posts
    639
    Rep Power
    41

    Re: problema swapChild clip in rotazione

    Ciao toni_1974!
    purtroppo no.. dopo averci sbattuto la testa per un bel pò..
    ho messo da parte lo script =(

    non sono riuscito a trovare una logica per dirgli quando effettuare lo swap dei clip..

    spero che qualc'uno che ha risolto il problema riesca a darci una dritta !

  6. #6
    Junior Member Settled In Lestaat is on a distinguished road
    Join Date
    Feb 2008
    Posts
    2
    Rep Power
    0

    Re: problema swapChild clip in rotazione

    Un po' barbaro, ma m'è venuto così sul momento.

    Code:
    var radiusX:Number = 300;
    var radiusY:Number = 75;
    
    //stage width/2
    var centerX:Number = 680 / 2;
    //stage height/2
    var centerY:Number = 415 / 2;
    
    var speed:Number = 0.05;
    var perspective:Number = 130;
    
    
    private function mover(e:Event):void
            {
                e.target.x = Math.cos(e.target.angle) * radiusX + centerX;
                e.target.y = Math.sin(e.target.angle) * radiusY + centerY;
                var s = (e.target.y + perspective) /(centerY+radiusY-perspective);
                e.target.scaleX = e.target.scaleY = s/3;
                e.target.angle += speed/2;
                var myDepth:Number;
                if(e.target.angle>=270) myDepth=(270-(e.target.angle-270))-90;
                if(e.target.angle<=90) myDepth=180-(90+e.target.angle);
                if((e.target.angle>90)and(e.target.angle<270)) myDepth=e.target.angle-90;
                swapChildrenAt(getChildIndex(e.target),myDepth);
          
            }

  7. #7
    Junior Member Settled In Lestaat is on a distinguished road
    Join Date
    Feb 2008
    Posts
    2
    Rep Power
    0

    Re: problema swapChild clip in rotazione

    -.-
    Ignoratemi, sto dando brutti segni di stress...
    Come primo post niente male eh?!
    LOL
    Ignoratemi.

  8. #8
    Junior Member Settled In toni_1974 is on a distinguished road
    Join Date
    Oct 2007
    Posts
    15
    Rep Power
    0

    Riferimento: problema swapChild clip in rotazione

    Ciao Lestaat, grazie per il tuo intervento.

    Ho provato a modificare il codice come dicevi te ma mi da errore di indice non compreso negli indici esistenti.

    Credo ma non ne sono sicuro, che se tento di passare un indice che non esiste già lui va in errore.

    Quindi rimango nella nebbia ..........

    grazie ancora toni

  9. #9
    Junior Member Settled In toni_1974 is on a distinguished road
    Join Date
    Oct 2007
    Posts
    15
    Rep Power
    0

    Riferimento: problema swapChild clip in rotazione

    Ciao dinuovo, volevo chiedere scusa a FLEP perchè avendo aperto due post dello stesso argomento non so piu quale mandare avanti dei due.


    Intanto ho modificato ulteriromente lo script.

    Com'è adesso il 90% sembra ok ma ancora non è apposto.
    Ma ho notato che i valori che gli passa la riga rossa servono a qualche cosa , ho visto che scalano ma non ho ancora capito bene la frequenza.
    Cmq passandogli quei valori facendo attenzione che non supera i valori indici lui si sitema ma non del tutto.....

    Se vi può aiutare a capire qualche cosa in più...

    ciaoo


    private function mover(evt:Event):void
    {

    evt.currentTarget.x = Math.cos(evt.currentTarget.angle) * radiusX + centerX;
    evt.currentTarget.y = Math.sin(evt.currentTarget.angle) * radiusY + centerY;

    var s = (evt.currentTarget.y - perspective)/(centerY+radiusY-perspective);

    evt.currentTarget.scaleX = evt.currentTarget.scaleY = s/2;
    evt.currentTarget.angle += speed/2;

    /*Riga as2 precedente da sostituire
    this.swapDepths(Math.round(this._xscale) + 100);*/


    var tab:MovieClip=evt.target as MovieClip;

    var test:int= Math.round(evt.currentTarget.scaleX*100/2)

    for(var i:int=0;i < thumbs_array.length;i++)
    {
    home.setChildIndex(tab,test);
    }

    }

  10. #10
    Member Settled In Maldor is on a distinguished road
    Join Date
    Jan 2008
    Posts
    39
    Rep Power
    0

    Re: problema swapChild clip in rotazione

    ciao a tutti.....il mio italiano e molto male dispiace se non si capisce, ma posso scrivere in inglese e forse qualcuno in grado di tradurre...questo e il codice in completo per il 3d menu...
    Questa versione carichi swfs!!!!!!

    PHP Code:
    import mx.utils.Delegate;
    //transitions for icon tween
    import mx.transitions.Tween;
    import mx.transitions.easing.*;

    var 
    numOfItems:Number;
    var 
    radiusX:Number 320;
    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;
    //text field invisible at startup
    myLoader._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;
        
    trace(numOfItems);
        for (var 
    i=0;i<numOfItems;i++)
       { 
          var 
    home.attachMovie ("item""item"+ii+1);
          
    t.angle * ((Math.PI*2)/numOfItems);
          
    t.onEnterFrame mover;
    //attributes called from XML
        
    t.toolText nodes[i].attributes.tooltip;
        
    t.movie nodes[i].attributes.movie;
        
    //t.content = nodes[i].attributes.content;
        //t.loadClip = nodes [i].attributes.movie;
        //t.myLoader = nodes[i].attributes.movie;
        //t.loadMovie = nodes[i].attributes.movie;
        //t.myLoader.loadMovie = nodes[i].attributes.movie;
        //t.movieClip = nodes[i].attributes.movie;
        //t.myLoader.loadMovie = nodes[i].attributes.movie;
        //t.page = nodes[i].attributes.movie;
        
    t.icon.inner.loadMovie (nodes [i].attributes.image);
        
    t.ref.inner.loadMovie (nodes [i].attributes.image);
        
    t.icon.onRollOver over;
        
    t.icon.onRollOut out;
        
    t.icon.onRelease released;
        
       }
    }

    function 
    over ()
    {
        
    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 ()
    {
        
    home.tooltip._alpha 0;
        for (var 
    i=0;i<numOfItems;i++)
        {
            
    //var to refer to icons in carousel
            
    var t:MovieClip home["item"+i]
            
    t.xPos t._x;
            
    t.yPos t._y;
            
    t.theScale t._xscale;
            
    //undo icon properties when fired
            
    delete t.icon.onRollOver;
            
    delete t.icon.onRollOut;
            
    delete t.icon.onRelease;
            
    delete t.onEnterFrame;
            
    //if statement to animated selected icon in a different way to all other items
            
    if (!= 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 (myLoader,"_alpha",Strong.easeOut,0,100,1,true);
                
    //theText.text = t.content;
                //mcLoader.loadClip(t.page ,myLoader);
                //myLoader.loadMovie = t.page;
                //myLoader.movieClip = t.movie;
                //myLoader.loadMovie = t.loadMovie;
                
                
                //THIS IS WHERE I EDITED!!!!
                
    myLoader.loadMovie(t.movie);
                
    //END!!!  Also, I edited once again on the unreleased() function! Ok, I don't know what you did wrong! I guess I just have the "magical fingers... =)
                
                
                
    var s:Object this;
                
    tw.onMotionStopped = function()
                {
                    
    s.onRelease unReleased;
                }
                
            }
            
        }
    }

    function 
    unReleased()
    {
        
    delete this.onRelease;
        var 
    tw:Tween = new Tween (theText,"_alpha",Strong.easeOut,100,0,0.5,true);
        var 
    tw2:Tween = new Tween (scroller,"_alpha",Strong.easeOut,100,0,0.5,true);
        for (var 
    i=0;i<numOfItems;i++)
        {
            var 
    t:MovieClip home["item"+i]
            
            
            
            
    myLoader.unloadMovie();

            
            
            if (
    != 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.onRollOutDelegate.create (t.icon,out);
                              
    t.icon.onReleaseDelegate.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");

    for (var 
    i=0;i<numOfItems;i++)

        var 
    this.attachMovie ("item""item"+ii+1);
        
    t.angle * ((Math.PI*2)/numOfItems);
        
    t.onEnterFrame mover;
    }

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

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

    e il xml ai una strutura cosi.............
    PHP Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <icons>

    <icons image="guy.png" tooltip="Filosofia" movie="xxx.swf" />

    <icons image="brxx.png" tooltip="bla" movie="rxxx.swf" />

    <icons image="paper.png" tooltip="xxx" movie="xxx.swf" />

    <icons image="guy.png" tooltip="xxx" movie="xxx.swf" />

    <icons image="bxx.png" tooltip="xxx" movie="xxx.swf" />

    <icons image="pxxr.png" tooltip="xxx" movie="xxx.swf" />



    </icons>

+ Reply to Thread
Page 1 of 2
1 2 LastLast

Similar Threads

  1. problema dimensioni Movie Clip
    By Tizzo:P in forum Actionscript 3.0 base
    Replies: 0
    Last Post: 18-03-09, 08:30
  2. Tweener e rotazione
    By siro in forum Actionscript 3.0 avanzato
    Replies: 3
    Last Post: 04-03-09, 07:37
  3. rotazione controllata
    By Jackalope in forum Actionscript 3.0 base
    Replies: 0
    Last Post: 18-02-09, 07:08
  4. Problemi di Rotazione!!!
    By seal in forum Actionscript 3.0 base
    Replies: 14
    Last Post: 15-04-08, 10:11
  5. problema con posizioni indici dei clip
    By toni_1974 in forum AIUTO utilità free
    Replies: 2
    Last Post: 04-02-08, 11:18

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Optimization by vBSEO