Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 21-11-2005, 14:15   #1 (permalink)
Neuer User
 
Registriert seit: May 2002
Beiträge: 80
Component anpassen

Hallo,

ich habe folgendes Component, welches ich gerne anpassen würde.
Das Component zoomt bei mouseEnter Elemente auf.
Wo im script muß ich es unterbringen, wenn ich mouseEnter durch onRelease einfügen will.

Wie kann ich zudem eingeben, daß die Elemente nicht an Ihrem Platz 0,0 aufzoomen, sondern an einer dafür definierten Stelle? Bsp. Bildmitte?
Wäre für jede Hilfe dankbar.

Grüße

PHP-Code:
/*
------------------------------------------------------
Zoomer Component, v2.2.1
------------------------------------------------------
updated august 21 2002
Martijn de Visser
www.flashcomponents.net
------------------------------------------------------
Public methods:
    enable()                enables the component
    disable()                disables the component
    isEnabled()                returns state of component
*/

#initclip

// construct
ZoomerClass = function(){
    
// enable by default
    
this.enabled true;    
    
// initialize
    
this.init();
}

// register class
Object.registerClass("ZoomerClassSymbol"ZoomerClass);

// initialize component
ZoomerClass.prototype.init = function()
{
    if (
this._targetInstanceName.length 0
    {
        
this.zoomTarget this.targetInstance this._parent[this._targetInstanceName];
        if (
this.zoomTarget instanceof MovieClip
        {
            if ((!
this.scaleX)&&(!this.scaleY)) { this.enabled false;    }
            
this._visible false;
            
this.resizing false;
            
this.mouseSwitched false;
            
this.minZoomX this.zoomTarget._xscale;
            
this.minZoomY this.zoomTarget._yscale;
            
this.oldDepth this.zoomTarget.getDepth();
            if (
this.maxZoom 100) {this.maxZoom 100;}
            if (
this.zoomSpeed 0.01) {this.zoomSpeed 0.01;}
            
            if (
this.startZoomedIn
            {
                
this.forward false;
                
this.zoomTarget._xscale this.maxZoom;
                
this.zoomTarget._yscale this.maxZoom;
            } 
            else 
            {
                
this.forward true;
            }
            
        }
        else 
        {
            
trace("Zoomer Component: no target movieclip found...");
            
this.enabled false;
        }
    }    
}

ZoomerClass.prototype.onMouseMove = function() 
{
    if (
this.enabled)
    {
        if(
this.zoomTarget.hittest(_root._xmouse,_root._ymousethis.respectShape)) 
        {
            
// mouse comes within target clip area
            
if (this.mouseSwitched)
            {
                
this.mouseSwitched false;
                
this.mouseEnter();
            }
        }
        else
        {
            
// mouse goes out of target clip area
            
if (!this.mouseSwitched)
            {
                
this.mouseSwitched true;
                
this.mouseLeave();
            }
        }
    }
}

ZoomerClass.prototype.mouseEnter = function() 
{
    if (!
this.resizing
    {
        
this.resizing  true;
        
this.forward true;
    } 
    else 
    {
        if (!
this.forward
        {
            
this.forward true;
        }
        else 
        {
            
this.forward false;
        }
    }
}

ZoomerClass.prototype.mouseLeave = function() 
{
    if (!
this.resizing)
    {
        
this.resizing  true;
        
this.forward false;
    }
    else
    {
        if (!
this.forward
        {
            
this.forward true;
        }
        else 
        {
            
this.forward false;
        }
    }
}

ZoomerClass.prototype.onEnterFrame = function() 
{
    if (
this.enabled)
    {
        if(
this.zoomTarget.hittest(_root._xmouse,_root._ymousethis.respectShape)) 
        {
            
// mouse comes within target clip area
            
if (this.mouseSwitched)
            {
                
this.mouseSwitched false;
                
this.mouseEnter();
            }
        }
        else 
        {
        
// mouse goes out of target clip area
            
if (!this.mouseSwitched)
            {
                
this.mouseSwitched true;
                
this.mouseLeave();
            }
        }
        if (
this.resizing)
        {
            if (
this.forward)
            {
                
// zoom in
                
this.zoomTarget.swapDepths(1000);
                if (
this.scaleX) { this.zoomTarget._xscale this.zoomTarget._xscale + (this.zoomSpeed*(this.maxZoom-this.zoomTarget._xscale));    }
                if (
this.scaleY) { this.zoomTarget._yscale this.zoomTarget._yscale + (this.zoomSpeed*(this.maxZoom-this.zoomTarget._yscale)); }
                if ((
this.zoomTarget._xscale >= this.maxZoom-1) || (this.zoomTarget._yscale >= this.maxZoom-1)) 
                {
                    
// end of zoom in routine
                    
if (this.scaleX) { this.zoomTarget._xscale this.maxZoom; }
                    if (
this.scaleY) { this.zoomTarget._yscale this.maxZoom; }
                    
this.resizing false;
                    
this.forward false;
                }
            }
            else
            {
                
// zoom out
                
if (this.scaleX) { this.zoomTarget._xscale this.zoomTarget._xscale - (this.zoomSpeed*(this.zoomTarget._xscale-this.minZoomX)); }
                if (
this.scaleY) { this.zoomTarget._yscale this.zoomTarget._yscale - (this.zoomSpeed*(this.zoomTarget._yscale-this.minZoomY)); }
                if (((
this.scaleX) && (this.zoomTarget._xscale this.minZoomX+1)) || ((this.scaleY) && (this.zoomTarget._yscale this.minZoomY+1))) 
                {
                    
// end of zoom out routine
                    
if (this.scaleX) { this.zoomTarget._xscale this.minZoomX; }
                    if (
this.scaleY) { this.zoomTarget._yscale this.minZoomY; }
                    
this.resizing false;
                    
this.forward true;
                    
this.zoomTarget.swapDepths(this.oldDepth);
                }
            }
        }
    }
}

// disable Zoom behaviour
ZoomerClass.prototype.disable = function()
{
    
this.enabled false;
}

// enable Zoom behaviour
ZoomerClass.prototype.enable = function()
{
    
this.enabled true;
}

// return enabled state
ZoomerClass.prototype.isEnabled = function()
{
    return 
this.enabled;    
}

#endinitclip 
hirst ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 01:12 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele