scrolling issue

I need help ActionScripting a scrolling window

Page 1 of 1

1 Replies - 2580 Views - Last Post: 08 March 2007 - 07:20 AM

#1 bradiusmax  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 27-February 07

scrolling issue

Posted 02 March 2007 - 04:59 PM

So I have this MovieClip made up of posters and it scrolls from right to left across the movie window. I scripted it so that the when the mouse rolls over the posters the user is able to control the direction and speed of the scrolling. My problem is this: I'm trying to make it so that Text in the form of MovieClips fades in and out in relation to certain parts of the Poster MovieClip.

"Manage" and "Humble" are two of the Text MovieClips and I tried telling flash:

	//increase the "manage" alpha
	if(posters._x >= 2850) {
		manage._alpha += 3;
	}
	
	//decrease the "manage" alpha
	if(posters._x <= 300) {
		manage._alpha -= 5;

	//increase the "humble" alpha
	if(posters._x <= -1000) {
		humble._alpha += 3;
	}
	
	//decrease the "humble" alpha
	if(posters._x <= -1001) {
		humble._alpha += 3;
	}



This is supposed to tell flash that when the poster MovieClip scrolls to a certain point that it should fade "Manage" in or out. It works for the most part but the strange part is that logically I would think that once you scrolled to the point where "Manage" fades out then you could scroll backwards and then it would fade back in because, once again:

	//increase the "manage" alpha
	if(posters._x >= 2850) {
		manage._alpha += 3;
	}



Regardless, I'm having all sorts of issues because I need three different Text MovieClips to fade in and out in relation to certain parts of the poster scroll and I don't know exactly how to write the code. Here's what I have so far in its entirety. Any ideas? Suggestions?:

//start "posters" move
this.onEnterFrame = function() {
	this.posters._x -= 3;
}

posters.onRollOver = postersOver;

function postersOver() {
	this.onEnterFrame = scrollPosters;
	delete this.onRollOver;
}

var b = stroke.getBounds(_root);

function scrollPosters() {
	if(_xmouse<b.xMin || _xmouse>b.zMax || _ymouse<b.yMin || _ymouse>b.yMax) {
		this.onRollOver = postersOver;
		delete this.onEnterFrame;
	}
	//stop "posters" @ left
	if(posters._x >= 4925) {
		posters._x = 4925;
	}
	
	//stop "posters" @ right	
	if(posters._x <= -3950) {
		posters._x = -3950;
	}
	
	//increase the "manage" alpha
	if(posters._x >= 2850) {
		manage._alpha += 3;
	}
	
	//decrease the "manage" alpha
	if(posters._x <= 300) {
		manage._alpha -= 5;
				}

	//increase the "humble" alpha
	if(posters._x <= -1000) {
		humble._alpha += 3;
	}
	
	//decrease the "humble" alpha
	if(posters._x <= -1001) {
		humble._alpha += 3;
	}

				var xdist = _xmouse - 350;
	
	posters._x += -xdist / 15;
	
}



Is This A Good Question/Topic? 0
  • +

Replies To: scrolling issue

#2 Motorman007  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 08-March 07

Re: scrolling issue

Posted 08 March 2007 - 07:20 AM

View Postbradiusmax, on 2 Mar, 2007 - 04:59 PM, said:

So I have this MovieClip made up of posters and it scrolls from right to left across the movie window. I scripted it so that the when the mouse rolls over the posters the user is able to control the direction and speed of the scrolling. My problem is this: I'm trying to make it so that Text in the form of MovieClips fades in and out in relation to certain parts of the Poster MovieClip.

"Manage" and "Humble" are two of the Text MovieClips and I tried telling flash:

	//increase the "manage" alpha
	if(posters._x >= 2850) {
		manage._alpha += 3;
	}
	
	//decrease the "manage" alpha
	if(posters._x <= 300) {
		manage._alpha -= 5;

	//increase the "humble" alpha
	if(posters._x <= -1000) {
		humble._alpha += 3;
	}
	
	//decrease the "humble" alpha
	if(posters._x <= -1001) {
		humble._alpha += 3;
	}



This is supposed to tell flash that when the poster MovieClip scrolls to a certain point that it should fade "Manage" in or out. It works for the most part but the strange part is that logically I would think that once you scrolled to the point where "Manage" fades out then you could scroll backwards and then it would fade back in because, once again:

	//increase the "manage" alpha
	if(posters._x >= 2850) {
		manage._alpha += 3;
	}



Regardless, I'm having all sorts of issues because I need three different Text MovieClips to fade in and out in relation to certain parts of the poster scroll and I don't know exactly how to write the code. Here's what I have so far in its entirety. Any ideas? Suggestions?:

//start "posters" move
this.onEnterFrame = function() {
	this.posters._x -= 3;
}

posters.onRollOver = postersOver;

function postersOver() {
	this.onEnterFrame = scrollPosters;
	delete this.onRollOver;
}

var b = stroke.getBounds(_root);

function scrollPosters() {
	if(_xmouse<b.xMin || _xmouse>b.zMax || _ymouse<b.yMin || _ymouse>b.yMax) {
		this.onRollOver = postersOver;
		delete this.onEnterFrame;
	}
	//stop "posters" @ left
	if(posters._x >= 4925) {
		posters._x = 4925;
	}
	
	//stop "posters" @ right	
	if(posters._x <= -3950) {
		posters._x = -3950;
	}
	
	//increase the "manage" alpha
	if(posters._x >= 2850) {
		manage._alpha += 3;
	}
	
	//decrease the "manage" alpha
	if(posters._x <= 300) {
		manage._alpha -= 5;
				}

	//increase the "humble" alpha
	if(posters._x <= -1000) {
		humble._alpha += 3;
	}
	
	//decrease the "humble" alpha
	if(posters._x <= -1001) {
		humble._alpha += 3;
	}

				var xdist = _xmouse - 350;
	
	posters._x += -xdist / 15;
	
}




Yo Playa check out this vid

Drag Slide Fade


http://gotoandlearn.com/

it is under

Flash Math 2
Flash Math 1
Drag Slide Fade


Here is some brain food for you


Quote

/**
Fades a MovieClip alpha value over time
@author Brendan Dawes
@version 1.1
@example
<code>
var f:Fade = new Fade(instanceName,1);
f.fadeAlphaTo(50);
</code>
*/

class com.dragslidefade.Fade {

private var target:MovieClip;
private var depth:Number;

/**
Callback function triggered when fade has completed
*/

public var onFadeComplete:Function;

function Fade($target:MovieClip,$depth:Number) {

target = $target;
depth = $depth;

}

/**
* fadeAlphaTo method
@param a the alpha value to fade to
*/

public function fadeAlphaTo (a:Number){
var pointer:Object = this;
target.createEmptyMovieClip("dsf_fade",depth);
target.dsf_fade.targetA = a;
target.dsf_fade.precision = 2;
target.dsf_fade.onEnterFrame = function(){
if(Math.abs(this._parent._alpha - this.targetA) < this.precision){
this._parent._alpha=this.targetA;
pointer.onFadeComplete();
this.removeMovieClip();
}
this._parent._alpha -= (this._parent._alpha - this.targetA)*.5;

}



}




}




this is what i use the most

var f:Fade = new Fade(instanceName,1);
f.fadeAlphaTo(50);



var f:Fade = new Fade(manage,1);


""_mc.onPress = function()
{
f.fadeAlphaTo(100);
}


""_mc.onRollOut = function()
{
f.fadeAlphaTo(0);
}

This post has been edited by Motorman007: 08 March 2007 - 07:25 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1