PDA

Volledige versie bekijken : continue laten scrollen van een aantal thumbnails...?


vic76
%Europe/Berlin %918 %2007, 22:02
Hallo,

Ik probeer een continue scrollende thumbnail list te maken, die reageert op de Y positie van de mouse...

Ik heb een container gemaakt waarin ik de thumbnails load, en deze vervolgens gedupliceerd.

Bovenop deze containers staat een Mask.

Het idee is dat wanneer de Y positie van container 1 buiten het gemaskeerde gebied valt, container 2, BOVEN/ONDER container 1 wordt gezet, zodat je een continue loopende scroller krijgt.

Helaas kom ik er niet meer uit, ben al de hele dag er mee bezig en wordt onderhand een beetje ....

Mijn code:

package com.figger.thumbnailScroller
{
import flash.display.*;
import flash.events.*;
import flash.net.*;

public class thumbnailScroller extends MovieClip
{
public var thisX:Number = 10;
public var thisY:Number = 10;

public var thumbPannel_2_y:Number;

public var thumbPannel_1:pannel;
public var thumbPannel_2:pannel;

public var thumbLdr1:Loader;
public var thumbLdr2:Loader;

private var thumbs:Array = new Array("DCP_0730.jpg","DCP_0731.jpg","DCP_0732.jpg","DCP_0733.jpg","DCP_0734.jpg","DCP_0735.jpg");

public function thumbnailScroller()
{
// create the 1st thumbs container...
thumbPannel_1 = new pannel();
thumbPannel_2 = new pannel();

thumbPannel_1.x = 400;
thumbPannel_1.y = 20;

stage.addChild(thumbPannel_1);

// populate the 1st thumbs container with MC's...
for (var i=0;i<thumbs.length;i++)
{
thumbLdr1 = new Loader();
thumbLdr1.load(new URLRequest(thumbs[i]));

thumbLdr2 = new Loader();
thumbLdr2.load(new URLRequest(thumbs[i]));

var thumb1:thumbnailItem = new thumbnailItem();
var thumb2:thumbnailItem = new thumbnailItem();

thumb1.x = thisX;
thumb1.y = thisY;
thumbLdr1.scaleX = 0.19;
thumbLdr1.scaleY = 0.23;
thumbLdr1.x = 4;
thumbLdr1.y = 4;

thumb2.x = thisX;
thumb2.y = thisY;
thumbLdr2.scaleX = 0.19;
thumbLdr2.scaleY = 0.23;
thumbLdr2.x = 4;
thumbLdr2.y = 4;

if (((i + 1) % 5) == 0)
{
thisY += 90;
}
else
{
thisY += 90;
}

thumbPannel_1.addChild(thumb1);
thumbPannel_2.addChild(thumb2);
thumb1.addChild(thumbLdr1);
thumb2.addChild(thumbLdr2);

// determine Y position of our 2nd thumbs container...
thumbPannel_2_y = thumbPannel_1.height;
}

// create the 2nd thumbs container...
thumbPannel_2.x = 400;
thumbPannel_2.y = thumbPannel_2_y;

stage.addChild(thumbPannel_2);

// create a mask for our 2 containers
var masker:MovieClip = new MovieClip();
masker.graphics.beginFill(0xff0000);
masker.graphics.drawRect(380,50,150,200);
addChild(masker);

thumbPannel_1.mask = masker;
//thumbPannel_2.mask = masker

// listen for mouse movements...
stage.addEventListener(MouseEvent.MOUSE_MOVE, doScroll);

}


private function doScroll(e:MouseEvent):void
{

if (e.stageY < stage.stageHeight / 2)
{
stage.addEventListener(Event.ENTER_FRAME, scrollUp);
stage.addEventListener(Event.ENTER_FRAME, scrollUp);
}
if (e.stageY > stage.stageHeight / 2)
{
stage.addEventListener(Event.ENTER_FRAME, scrollDown);
stage.removeEventListener(Event.ENTER_FRAME, scrollUp);
stage.addEventListener(Event.ENTER_FRAME, scrollDown);
stage.removeEventListener(Event.ENTER_FRAME, scrollUp);
}
}

private function scrollUp(e:Event):void
{

thumbPannel_1.y --;
thumbPannel_2.y --;

}

private function scrollDown(e:Event):void
{
thumbPannel_1.y ++;
thumbPannel_2.y ++;
}

}
}


Heeft iemand een idee hoe ik dit voor elkaar boks?
Mvgr,

Vic.