Re: [Flashcoders] reparent child to halt scroll

2008-03-24 Thread Allandt Bik-Elliott (Receptacle)

i guess this one's not something you guys want to touch eh?

never mind then

a


On 21 Mar 2008, at 10:16, Allandt Bik-Elliott (Receptacle) wrote:


noone have the time to look at this one?


On 20 Mar 2008, at 15:25, Allandt Bik-Elliott (Receptacle) wrote:


hi guys

i'm a bit stuck with a project i'm working on. I have a timeline  
which all runs off a scrollbar similar to the one in the kirupa  
forum (http://www.kirupa.com/forum/showthread.php?t=245468 -  
amended to go horizontal and us Tweener to act a bit more smoothly)


at the moment, i have 2 sprites, 1 scrolls with the scrollbar and  
1 doesn't.
on the scrolling sprite i have several panels and the start of  
some ticks plus a mask for the non-scrolling textfield which is on  
the other sprite


everything works as it should with this, however - i'd like to  
push it a bit further so that the title (mainTitle) scrolls with  
the rest of the panels but when it hits the left hand side, it  
reparents to the non-scrolling sprite and stays there
you can see an example of this at http://www.bbc.co.uk/history/ 
british/launch_tl_british.shtml - which i think is a really  
elegant solution to the problem of overlong panels, designed to  
take several points of interest


i've tried having everything on the scrollable sprite and  moving  
the title backwards using a SliderEvent (custom event for the  
scrollbar) but the globalToLocal() method just gets really jumpy  
and doesn't seem to put the titles in the right place or return  
them correctly


this is my class:

CODE
package
{
//package imports
import flash.display.Sprite;

//scrollbar imports
import com.caurina.transitions.*;
import flash.geom.*;
import flash.events.*;
import flash.text.TextFormat;
import com.receptacle.utils.*;

internal class TimelineArea extends Sprite
{
// class variable declarations
private var cp:CommonProperties;
private var taTitleBarY;
private var taPanelY:uint;
private var taPanelHeight:uint
private var scrollableBase:Sprite;
private var scrollbar:Scrollbar
private var stage_width:uint;
private var stage_height:uint;

private var panelY:uint;
private var panelColour:uint;
private var taTitleBarHeight:uint;
private var nonScrollableBase:Sprite;
private var commonGrey:uint;
private var subheadingFont:String;
private var headingFont:String;

// constructor
public function TimelineArea():void
{
setVars();
addTicks();
addPanels();
addPeriodBars();
addImageLandmark();
initialiseTimelineScrollBar();
}

private function setVars()
{
scrollbar = new Scrollbar();
cp = new CommonProperties();
stage_width  = cp.stage_width;
stage_height = cp.stage_height;
taTitleBarHeight = cp.taTitleBarHeight;
taTitleBarY  = cp.taTitleBarY;
taPanelY = cp.taPanelY;
taPanelHeight= cp.taPanelHeight;
commonGrey   = cp.tickColour;
headingFont  = cp.headingFont;
subheadingFont   = cp.subheadingFont;

scrollbar.x = 16;
scrollbar.y = 550-cp.titleBarHeight;

scrollableBase = new Sprite();
nonScrollableBase = new Sprite();
scrollableBase.y = 0;

addChild(scrollableBase);
addChild(nonScrollableBase);
}

private function addPanels():void
{
trace (Background panels added);

			createPanel(0, 1000, 0xB6, Prehistory, c. 1.7 million -  
4000 B.C.E.);
			createPanel(1000, 2000, 0xB65B00, Early Civilisations, c.  
1.7 million - 4000 B.C.E.);
			createPanel(3000, 2000, 0x123456, Sumfink Else, c. 1.7  
million - 4000 B.C.E.);



}

		private function createPanel(panelX:Number, panelWidth:int,  
panelColour:uint, pTitle:String, date:String):void

{
			// SimpleRectangle class (rColour:uint, rOutlineColour:uint,  
rX:Number, rY:Number, rWidth:uint, rHeight:uint)
			var 

Re: [Flashcoders] reparent child to halt scroll

2008-03-21 Thread Allandt Bik-Elliott (Receptacle)

noone have the time to look at this one?


On 20 Mar 2008, at 15:25, Allandt Bik-Elliott (Receptacle) wrote:


hi guys

i'm a bit stuck with a project i'm working on. I have a timeline  
which all runs off a scrollbar similar to the one in the kirupa  
forum (http://www.kirupa.com/forum/showthread.php?t=245468 -  
amended to go horizontal and us Tweener to act a bit more smoothly)


at the moment, i have 2 sprites, 1 scrolls with the scrollbar and 1  
doesn't.
on the scrolling sprite i have several panels and the start of some  
ticks plus a mask for the non-scrolling textfield which is on the  
other sprite


everything works as it should with this, however - i'd like to push  
it a bit further so that the title (mainTitle) scrolls with the  
rest of the panels but when it hits the left hand side, it  
reparents to the non-scrolling sprite and stays there
you can see an example of this at http://www.bbc.co.uk/history/ 
british/launch_tl_british.shtml - which i think is a really elegant  
solution to the problem of overlong panels, designed to take  
several points of interest


i've tried having everything on the scrollable sprite and  moving  
the title backwards using a SliderEvent (custom event for the  
scrollbar) but the globalToLocal() method just gets really jumpy  
and doesn't seem to put the titles in the right place or return  
them correctly


this is my class:

CODE
package
{
//package imports
import flash.display.Sprite;

//scrollbar imports
import com.caurina.transitions.*;
import flash.geom.*;
import flash.events.*;
import flash.text.TextFormat;
import com.receptacle.utils.*;

internal class TimelineArea extends Sprite
{
// class variable declarations
private var cp:CommonProperties;
private var taTitleBarY;
private var taPanelY:uint;
private var taPanelHeight:uint
private var scrollableBase:Sprite;
private var scrollbar:Scrollbar
private var stage_width:uint;
private var stage_height:uint;

private var panelY:uint;
private var panelColour:uint;
private var taTitleBarHeight:uint;
private var nonScrollableBase:Sprite;
private var commonGrey:uint;
private var subheadingFont:String;
private var headingFont:String;

// constructor
public function TimelineArea():void
{
setVars();
addTicks();
addPanels();
addPeriodBars();
addImageLandmark();
initialiseTimelineScrollBar();
}

private function setVars()
{
scrollbar = new Scrollbar();
cp = new CommonProperties();
stage_width  = cp.stage_width;
stage_height = cp.stage_height;
taTitleBarHeight = cp.taTitleBarHeight;
taTitleBarY  = cp.taTitleBarY;
taPanelY = cp.taPanelY;
taPanelHeight= cp.taPanelHeight;
commonGrey   = cp.tickColour;
headingFont  = cp.headingFont;
subheadingFont   = cp.subheadingFont;

scrollbar.x = 16;
scrollbar.y = 550-cp.titleBarHeight;

scrollableBase = new Sprite();
nonScrollableBase = new Sprite();
scrollableBase.y = 0;

addChild(scrollableBase);
addChild(nonScrollableBase);
}

private function addPanels():void
{
trace (Background panels added);

			createPanel(0, 1000, 0xB6, Prehistory, c. 1.7 million -  
4000 B.C.E.);
			createPanel(1000, 2000, 0xB65B00, Early Civilisations, c. 1.7  
million - 4000 B.C.E.);
			createPanel(3000, 2000, 0x123456, Sumfink Else, c. 1.7  
million - 4000 B.C.E.);



}

		private function createPanel(panelX:Number, panelWidth:int,  
panelColour:uint, pTitle:String, date:String):void

{
			// SimpleRectangle class (rColour:uint, rOutlineColour:uint,  
rX:Number, rY:Number, rWidth:uint, rHeight:uint)
			var mainTitlePanel:SimpleRectangle = new SimpleRectangle 
(0xFF, panelColour, panelX, 0, panelWidth, taTitleBarHeight);


[Flashcoders] reparent child to halt scroll

2008-03-20 Thread Allandt Bik-Elliott (Receptacle)

hi guys

i'm a bit stuck with a project i'm working on. I have a timeline  
which all runs off a scrollbar similar to the one in the kirupa forum  
(http://www.kirupa.com/forum/showthread.php?t=245468 - amended to go  
horizontal and us Tweener to act a bit more smoothly)


at the moment, i have 2 sprites, 1 scrolls with the scrollbar and 1  
doesn't.
on the scrolling sprite i have several panels and the start of some  
ticks plus a mask for the non-scrolling textfield which is on the  
other sprite


everything works as it should with this, however - i'd like to push  
it a bit further so that the title (mainTitle) scrolls with the rest  
of the panels but when it hits the left hand side, it reparents to  
the non-scrolling sprite and stays there
you can see an example of this at http://www.bbc.co.uk/history/ 
british/launch_tl_british.shtml - which i think is a really elegant  
solution to the problem of overlong panels, designed to take several  
points of interest


i've tried having everything on the scrollable sprite and  moving the  
title backwards using a SliderEvent (custom event for the scrollbar)  
but the globalToLocal() method just gets really jumpy and doesn't  
seem to put the titles in the right place or return them correctly


this is my class:

CODE
package
{
//package imports
import flash.display.Sprite;

//scrollbar imports
import com.caurina.transitions.*;
import flash.geom.*;
import flash.events.*;
import flash.text.TextFormat;
import com.receptacle.utils.*;

internal class TimelineArea extends Sprite
{
// class variable declarations
private var cp:CommonProperties;
private var taTitleBarY;
private var taPanelY:uint;
private var taPanelHeight:uint
private var scrollableBase:Sprite;
private var scrollbar:Scrollbar
private var stage_width:uint;
private var stage_height:uint;

private var panelY:uint;
private var panelColour:uint;
private var taTitleBarHeight:uint;
private var nonScrollableBase:Sprite;
private var commonGrey:uint;
private var subheadingFont:String;
private var headingFont:String;

// constructor
public function TimelineArea():void
{
setVars();
addTicks();
addPanels();
addPeriodBars();
addImageLandmark();
initialiseTimelineScrollBar();
}

private function setVars()
{
scrollbar = new Scrollbar();
cp = new CommonProperties();
stage_width  = cp.stage_width;
stage_height = cp.stage_height;
taTitleBarHeight = cp.taTitleBarHeight;
taTitleBarY  = cp.taTitleBarY;
taPanelY = cp.taPanelY;
taPanelHeight= cp.taPanelHeight;
commonGrey   = cp.tickColour;
headingFont  = cp.headingFont;
subheadingFont   = cp.subheadingFont;

scrollbar.x = 16;
scrollbar.y = 550-cp.titleBarHeight;

scrollableBase = new Sprite();
nonScrollableBase = new Sprite();
scrollableBase.y = 0;

addChild(scrollableBase);
addChild(nonScrollableBase);
}

private function addPanels():void
{
trace (Background panels added);

			createPanel(0, 1000, 0xB6, Prehistory, c. 1.7 million -  
4000 B.C.E.);
			createPanel(1000, 2000, 0xB65B00, Early Civilisations, c. 1.7  
million - 4000 B.C.E.);
			createPanel(3000, 2000, 0x123456, Sumfink Else, c. 1.7 million  
- 4000 B.C.E.);



}

		private function createPanel(panelX:Number, panelWidth:int,  
panelColour:uint, pTitle:String, date:String):void

{
			// SimpleRectangle class (rColour:uint, rOutlineColour:uint,  
rX:Number, rY:Number, rWidth:uint, rHeight:uint)
			var mainTitlePanel:SimpleRectangle = new SimpleRectangle(0xFF,  
panelColour, panelX, 0, panelWidth, taTitleBarHeight);

scrollableBase.addChild(mainTitlePanel);

			// SimpleTextField class (tfColour:uint,