Bonjour,
Suite à l'adaptation d'un template flash, je bloque dans la scroll bar, qui fait appel a un texte en xml. En effet, la scoll bar marche pour un certain nombre de ligne mais au dela impssible de scoller plus bas. Voici le code j'espère que quelqu'un pourra m'aider . Merci par avance au bienfaiteur
import caurina.transitions.Tweener;
var sd:Number;
var sr:Number;
var cd:Number;
var cr:Number;
var new_y:Number;
var drag_area:Rectangle;
var flashmo_content:MovieClip;
var flashmo_content_area:MovieClip;
var scrolling_speed:Number; // 0.00 to 1.00
var wheel_value:Number;
function scrolling( ct:String, ct_area:String, speed:Number ):void
{
scrolling_speed = speed;
if( scrolling_speed < 0 || scrolling_speed > 1 ) scrolling_speed = 0.50;
flashmo_content = parent[ct];
flashmo_content_area = parent[ct_area];
flashmo_scroller.x = flashmo_scrollable_area.x;
flashmo_scroller.y = flashmo_scrollable_area.y;
flashmo_content.mask = flashmo_content_area;
flashmo_content.x = flashmo_content_area.x;
flashmo_content.y = flashmo_content_area.y;
sr = flashmo_content_area.height / flashmo_content.height;
flashmo_scroller.height = flashmo_scrollable_area.height * sr;
sd = flashmo_scrollable_area.height - flashmo_scroller.height;
cd = flashmo_content.height - flashmo_content_area.height;
cr = cd / sd * 1;
drag_area = new Rectangle(0, 0, 1, flashmo_scrollable_area.height - flashmo_scroller.height + 5);
flashmo_scroller.visible = flashmo_scrollable_area.visible = true;
flashmo_scroller.addEventListener( MouseEvent.MOUSE_DOWN, scroller_drag );
flashmo_scroller.addEventListener( MouseEvent.MOUSE_UP, scroller_drop );
flashmo_content.addEventListener( MouseEvent.MOUSE_WHEEL, scroller_wheel );
this.addEventListener( Event.ENTER_FRAME, on_scroll );
if ( flashmo_content.height <= flashmo_content_area.height )
{
flashmo_scroller.visible = flashmo_scrollable_area.visible = false;
flashmo_scroller.removeEventListener( MouseEvent.MOUSE_DOWN, scroller_drag );
flashmo_scroller.removeEventListener( MouseEvent.MOUSE_UP, scroller_drop );
flashmo_content.removeEventListener( MouseEvent.MOUSE_WHEEL, scroller_wheel );
this.removeEventListener( Event.ENTER_FRAME, on_scroll );
}
}
function scroller_drag( me:MouseEvent ):void
{
me.target.startDrag(false, drag_area);
stage.addEventListener(MouseEvent.MOUSE_UP, up);
}
function scroller_drop( me:MouseEvent ):void
{
me.target.stopDrag();
stage.removeEventListener(MouseEvent.MOUSE_UP, up);
}
function scroller_wheel(e:MouseEvent):void
{
if( e.delta > 0 )
wheel_value = flashmo_scroller.y - 60;
else
wheel_value = flashmo_scroller.y + 60;
if( wheel_value < 0 )
wheel_value = 0;
if( wheel_value > flashmo_scrollable_area.height - flashmo_scroller.height )
wheel_value = flashmo_scrollable_area.height - flashmo_scroller.height;
Tweener.addTween( flashmo_scroller,
{ y: wheel_value, time: 0.6, transition: "easeOut" } );
}
function up( me:MouseEvent ):void
{
flashmo_scroller.stopDrag();
}
function on_scroll( e:Event ):void
{
new_y = flashmo_content_area.y + flashmo_scrollable_area.y * cr - flashmo_scroller.y * cr;
flashmo_content.y += ( new_y - flashmo_content.y ) * scrolling_speed;