Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > Adobe Web Programming > Flash (all versions)
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Flash (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 11th, 2003, 06:44 AM
Registered User
 
Join Date: Jun 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default The Technique for Scrolling Without Break

In order to make a gesture driven scrolling without break, please do the following:

1. Place 11-movie clips on the stage aligned horizontally at the bottom. These clips can be any graphic, jpg, gif, or a simple rectangle. Name each of those clips like m0, m1,....m11.

2. Creat another movie clip, namely "Controller" which will control the other 11-movie clips movement.

3. Edit the "Controller" movie clips and place the following in its Frame1 through Frame 3:

ActionScript for Frame 1 of "Controller" movie clip:

this._visible=false;//making the "Controller" invisible

function createClipsArray() {//creating Array for
                             //11-movie clips reference
    var holder = new Array();
    for (var i = 0; i < 11; i++) {
        if (null != _parent["m" + i]) {
            holder[i] = _parent["m"+ i];
        }
    }
    return holder;
}

var Clips = createClipsArray();
var MW=550;//stage width
var Center=MW/2;//stage center
var TW=1180;//an arbitrary width of 11-movie clips
var Cons=(Math.pow(Center,3)+Math.pow(MW,3)+Math.pow(M W,2)+Math.pow(Width,2))/3;

var MouseX=0;
mouseLocation=0;

ActionScript for Frame 2 of the "Controller" movie clip:

var isOver=_root._xmouse>=1 && _root._xmouse<=550 &&_root._ymouse>=0 && _root._ymouse<=400;//stage area over which scrolling takes affect
                      //according to mouse position


if(isOver){
    MouseX=_root._xmouse-Center;
    mouseLocation=mouseLocation-Math.pow(MouseX*3,3)/Cons;

}

var ClipOrigin=0;

for(var i=0;i<Clips.length;i++){
    mouseLocation=mouseLocation%TW;
    var newX=mouseLocation+ClipOrigin;
    if(newX+Clips[i]._width<0){
        newX=TW+newX;
    }else if(newX>MW){
        newX=newX-TW;
    }

    Clips[i]._x=newX;
    ClipOrigin+=Clips[i]._width;
}

ActionScript for Frame 3 of the "Controller" movie clips

gotoAndPlay(2);

Thats all for gesture driven scrolling without break. Now test your movie.

This is in reply to my earlier topic which is read by a lot without any reply. Since, I know how to do it, therefore, I feel that everyone on this forum who dont know it may now know it.

I appreciate if someone can send me a Sothink Decompiler for learning purpose on the following email addresses:

[email protected]
or
[email protected]

Regards,





Similar Threads
Thread Thread Starter Forum Replies Last Post
Most efficient overriding technique jcsdeveloper C# 4 December 7th, 2005 04:18 PM
Unable to Break at Break point Girishbk VB.NET 2002/2003 Basics 0 January 18th, 2005 08:29 AM
Scrolling without break [email protected] Flash (all versions) 1 June 24th, 2003 06:20 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.