and80 devo proprio ringraziarti perché "magicamente" il file funziona benissimo e correttamente... praticamente non ci sarei mai arrivato neanche con 10 manuali di actioscript 2 davanti.
Ora riepilogo nel caso fosse utile...
allora ho preso il file .as e l'ho modificato secondo le istruzioni di and80 dando infine questo codice:
---------------------------------------------------------
codice:
import mx.utils.Delegate
import flash.geom.Rectangle
import flash.geom.Point
import flash.filters.DropShadowFilter
class Slider2
{
private var image:MovieClip
private var target:MovieClip
private var mouse:Point
private var rect:Rectangle
private var r_img:Rectangle
private var r_mask:Rectangle
private var _drop:DropShadowFilter
private var mc_loader:MovieClipLoader
private var x_pos:Number
private var y_pos:Number
function Slider2(scope:MovieClip, file:String)
{
image = scope.createEmptyMovieClip("image", 1)
image._x = 00
image._y = 00
image.cacheAsBitmap = true
target = scope
rect = new Rectangle(0, 0, 700, 700)
mouse = new Point(0,0)
_drop = new DropShadowFilter(3,45, 0x00, 30, 5, 5, .5)
x_pos = 0
y_pos = 0
load(file)
}
/**
* Load the image file
*/
private function load(file:String)
{
mc_loader = new MovieClipLoader()
mc_loader.addListener(this)
mc_loader.loadClip(file, image)
}
/**
* Once image has been loaded
* apply filters to the image movieclip
* and start the animation
*/
private function onLoadInit(tg:MovieClip):Void
{
image.filters = [_drop]
r_img = new Rectangle(0, 0, image._width, image._height)
r_mask = new Rectangle(image._x, image._y, rect.width, rect.height)
start();
}
public function start():Void
{
image.scrollRect = rect
image.onEnterFrame = Delegate.create(this, enterframe)
}
/**
* main enteframe function
* check mouse position and
* scroll the image
*/
private function enterframe():Void
{
mouse.x = target._xmouse
mouse.y = target._ymouse
if(r_mask.containsPoint(mouse))
{
y_pos = ((Math.abs(image._y - mouse.y)/rect.height)*(r_img.height-rect.height))
x_pos = ((Math.abs(image._x - mouse.x)/rect.width)*(r_img.width-rect.width))
}
rect.x += (x_pos - rect.x)/8
rect.y += (y_pos - rect.y)/8
image.scrollRect = rect
}
}
---------------------------------------------------------
poi, nel file .fla ho inserito il richiamo alla classe con:
codice:
var app:Slider2 = new Slider2(_root, "files/esempio.swf");
In questo caso a me interessava far scrollare un'altra animazione, ma è possibile mettere una qualsiasi immagine... Dopodiché bastera esportare il filmato scroller.swf e tutto funzionerà.
Inoltre, la gerarchia finale delle cartelle con i rispettivi file è quindi:
Cartella principale --> "Scroller"
Scroller (che contiene: "Slider2.as" - "scroller.fla" - "scroller.swf")
||
files (che contiene: esempio.swf )
GRAZIE ancora a tutti, specialmente a and80.
Ah... se te ne intendi anche di javascript o asp, puoi dare anche un occhio QUI, dato che non mi sa dar risposta nessuno ancora? Grazie ancora!
Simone