Adding Easing To Text Slider
Can anyone advise on on how to add easing to my text slider?
here's my code:
ActionScript Code: var myTextLoader:URLLoader = new URLLoader();myTextLoader.dataFormat=URLLoaderDataFormat.VARIABLES;myTextLoader.addEventListener(Event.COMPLETE, onLoaded);function onLoaded(e:Event):void {scrollText.text = e.target.data.main;}myTextLoader.load(new URLRequest("main.txt"));//scrollingscrollBar.addEventListener(MouseEvent.MOUSE_DOWN, dragSlider);stage.addEventListener(MouseEvent.MOUSE_UP, dropSlider);var bounds:Rectangle = new Rectangle(scrollBar.x, scrollBar.y,0,70);var dragging:Boolean = false;function dragSlider(event:MouseEvent):void{scrollBar.startDrag(false,bounds);dragging = true;}function dropSlider(event:MouseEvent):void{scrollBar.stopDrag();dragging = false;}function checkSlider(event:Event):void{//if(dragging){trace("scroll");}scrollText.scrollV = Math.round ((scrollBar.y - bounds.y)* scrollText.maxScrollV/70)}stage.addEventListener(Event.ENTER_FRAME, checkSlider);function textScrolled(event:Event):void{scrollBar.y = bounds.y + (scrollText.scrollV * 70/scrollText.maxScrollV);}scrollText.addEventListener(Event.SCROLL, textScrolled);
ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 01-11-2009, 12:16 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Flash 8 Scroll Text With Easing Using A Slider
(the same as on junkerjorg website!)
Does anyone know a good tutorial?
I was following this tutorial quite nicely
http://flash-creations.com/notes/act...scrolltext.php
untill the end where it is clearly missing a large portion of code so you can pay him to get the files. or am i being stupid?
I need to know how to make my slider move only up and down, at the moment you can move it wher you like, and how t actualy get it to controll the text.
here is the code i have so far, scrollbar5 is the name of my scroller descrip5 is the name of the textfield
many thanks in advance
// variable to store height of textfield after text added
var textheight:Number;
// variables for calculating scrollbar/textfield relationships
// position of scrollbar when at bottom:
var scrollbarbottom:Number = scrollbar5._y + (mask4._height - scrollbar5._height);
// range of scrollbar is from mask._y to scrollbarbottom:
var scrollbarrange:Number = scrollbarbottom - mask4._y;
// Scrolls descrip5 to follow scrollbar
function scrollOnMouseMove() {
this.startDrag(false, this._x, mask4._y, this._x, scrollbarbottom);
this.onMouseMove = function() {
descrip5._y = mask4._y - (textheight - mask4._height) * ((this._y-mask4._y) / scrollbarrange);
}
}
function stopScrollOnMouseMove() {
this.stopDrag();
delete this.onMouseMove;
}
function init() {
descrip5.htmlText = "<b>thisisjustsomesmapletextt";
}
// in init function:
descrip5.autoSize = "left";
// can use same textheight variable calculated for example 4
scrollbar5.onPress = scrollOnMouseMove;
scrollbar5.onRelease = scrollbar5.onReleaseOutside = stopScrollOnMouseMove;
init();
Horizontal Scroll Text With Easing Using A Slider
I found this really cool scroller on one of the threads. I'm novice flash designer and don't know anything about action scripting. but i did get it to work with my own content. Now I wish I could get a horizon scrollbar that scroll the content horizontally. Can someone help me please?
thanks so much guys!
Geng
Easing Slider?
Hello,
I ran into a slight problemo when trying to make my interface. I have some buttons near the bottom of the page, which when clicked activate a slider up top to travel across the page to that button on the x axis. I'm using this code to get the slider to move
tweenmechanics(mx.transitions.easing.Back.easeInOu t);
function tweenmechanics(easeType) {
var begin = 0;
var end = -433;
var time = 70;
var mc = slide_mc;
ballTween = new mx.transitions.Tween(mc, "_x", easeType, begin, end, time);
}
Now I can get it to move, that's no problem, but when I put this on the other buttons, I have to input a var begin. Now if the user clicks on say the 2nd button, then on the third, well I hope you can see my delima. I need to figure out a way for the button to do a check to see where the slider is, so I dont have to start it at a variable each time. The slider would jump to a certain spot instead of moving from it's rested place.
Hope that's kinda clear.
Any help would be greatly appreciated.
Easing Slider?
Hello,
I ran into a slight problemo when trying to make my interface. I have some buttons near the bottom of the page, which when clicked activate a slider up top to travel across the page to that button on the x axis. I'm using this code to get the slider to move
tweenmechanics(mx.transitions.easing.Back.easeInOut);
function tweenmechanics(easeType) {
var begin = 0;
var end = -433;
var time = 70;
var mc = slide_mc;
ballTween = new mx.transitions.Tween(mc, "_x", easeType, begin, end, time);
}
Now I can get it to move, that's no problem, but when I put this on the other buttons, I have to input a var begin. Now if the user clicks on say the 2nd button, then on the third, well I hope you can see my dilemma. I need to figure out a way for the button to do a check to see where the slider is, so I dont have to start it at a variable each time. The slider would jump to a certain spot instead of moving from it's rested place.
Hope that's kinda clear.
Any help would be greatly appreciated.
Please Help - Tween With Easing For Image Slider
Hi guys,
I got stuck while combining Lee Brimelow's 3D carousel actionscript tutorial with an image slider.
I have an external/linked mc that dynamically loads xml data into an image slider. That part works. See this link http://www.coolelektronik.ch/oscommerce/catalog/mp3.php
Now I wanted that each loaded image will be clickable like in Lee Brimelow's 3d Carousel (http://www.gotoandlearn.com/player.php?id=34) and that it will be enlarged onReleased while the rest of the slider disappears. My first mc is loading the imagebox mc (xml data for images to be loaded). The released function is part of the imagebox mc.
My biggest problem is the if else statement in this function. I was originally if(t._parent != this) in Brimelow's tutorial, but that did not work because in Brimelow's example the released function was with the mc on the main timeline (_level0). I tried changeing it to if(t != this) which I think always returned FALSE and changed t._parent in
tween(t._parent,"_xscale",Strong.easeOut,t._xscale,0,1,true);
to this
tween(this,"_xscale",Strong.easeOut,this._xscale,0,1,true);
...but I think I am stuck. At one point the images onrealesed faded out, but the others didn't.
Please help!!! I would be so appreciative... : )
ActionScript:
Code:
function released()
{
//BONUS Section
var sou:Sound = new Sound();
sou.attachSound("sdown");
sou.start();
for(var i=0;i<_parent.myXml.childNodes[0].childNodes.length;i++)
{
var t:MovieClip = attachMovie("imagebox", "im"+i, this.getNextHighestDepth());
t.xPos = t._x;
t.yPos = t._y;
t.theScale = t._xscale;
delete t.onRollOver;
delete t.onRollOut;
delete t.onRelease;
delete t.onEnterFrame;
if(t != this)
{
var tw:Tween = new Tween(this,"_xscale",Strong.easeOut,this._xscale,0,1,true);
var tw2:Tween = new Tween(this,"_yscale",Strong.easeOut,this._yscale,0,1,true);
var tw3:Tween = new Tween(this,"_alpha",Strong.easeOut,100,0,1,true);
}
else
{
var tw:Tween = new Tween(this._parent,"_xscale",Strong.easeOut,400,200,1,true);
var tw2:Tween = new Tween(this._parent,"_yscale",Strong.easeOut,400,200,1,true);
var tw3:Tween = new Tween(this._parent,"_x",Strong.easeOut,120,50,1,true);
var tw4:Tween = new Tween(this._parent,"_y",Strong.easeOut,0,320,1,true);
var tw5:Tween = new Tween(theText,"_alpha",Strong.easeOut,0,100,1,true);
var tw6:Tween = new Tween(thePrice,"_alpha",Strong.easeOut,0,100,1,true);
var tw6:Tween = new
var s:Object = this;
tw.onMotionStopped = function()
{
s.onRelease = unReleased;
}
}
}
}
Adding Easing ...
i have this code and its workin just fine ... what i want to do is to make the " centerME" mc to center it self with a bounce ease ... i tried my best but coudn,t it pull it of ... btw it already center it self ...
Code:
import mx.utils.Delegate;
Stage.scaleMode = "noScale";
Stage.align = "C";
var Movie:Object = new Object();
Movie.width = 550;
Movie.height = 350;
function positionStageMC():Void {
this._x = (Movie.width/2)-(Stage.width/2);
this._y = (Movie.height/2)-(Stage.height/2);
c2._x = Stage.width;
c2._y = 0;
c3._x = 0;
c3._y = Stage.height;
c4._x = Stage.width;
c4._y = Stage.height;
numba1._x = 0;
numba1._y = 0;
numba2._x = Stage.width;
numba2._y = 0;
numba3._x = Stage.height;
numba3._y = Stage.height;
numba4._x = Stage.height;
numba4._y = 0;
centerME._x = Stage.width/2;
centerME._y = Stage.height/2;
////1c._x = 0;
////1c._y = 0;
///////////////////////////////////////////////////
}
positionStageMC();
var slistener:Object = new Object();
slistener.onResize = Delegate.create(this, positionStageMC);
Stage.addListener(slistener);
help
Adding Easing To This Bit Of Script
onClipEvent(load) {
targetValue = 280
}
onClipEvent(enterFrame) {
if (MainGroup_mc._x!=targetValue){
if (MainGroup_mc._x<targetValue) {
MainGroup_mc._x += 10
} else if (MainGroup_mc._x>targetValue) {
MainGroup_mc._x -= 10
}
//trace(targetValue+" / "+MainGroup_mc._x)
}
}
Can anyone help?
i read this earlier,
Distx = myclip._x - destinationx
changex = Distx/myConstant
myClip._x -= changex
But im still learning and not sure.
Would it then be;
Distx = MainGroup_mc._x - destinationx
changex = Distx/5 //?
MainGroup_mc._x -= changex
The fla can be downloaded here
Adding And Easing X Position
Hello.
I'm trying somthing very simple, but I can't get it to work:
Say I have a mc, with a button next to it. If I click on the button, I want to ADD 50 units to the block's x position. That's easy, the problem is that the block shifts instantaneously. I want it to ease between the start and finish. When I click the button again it should ADD another 50 units etc.
WIth the easing script I use, I can only SPECIFY an x position VALUE, but I only want to ADD units to the mc's x position.
What I want is something in the lines of the map on this site (click the buttons to scroll the map):
http://www.newzealand.com/travel/tra...el-planner.cfm
Puhlleease help.
Adding Easing To Function
how could i include easing in this?
Code:
MovieClip.prototype.setTarg = function(targ) {
//specify the width and height of the movie
width = 780;
height = 570;
//-------------------
var dist, norm;
this.x = this._x;
this.speed = 25;
this.targx = targ;
dist = _root.DistanceBetweenPoints(this.x, this.targx);
norm = this.speed/dist;
this.diffx = (this.targx-this.x)*norm;
};
Adding Easing To My Scroller
I'm somewhat new to actionscripting but a fairly fast learner. Work wants me to create to a scroller like the one I've attached but with an elastic efftect to it.
I've looked at some others examples and some tutorials but was somewhat lost so I just sat down and tried coming up with a ghetto way. I the very basics done but im wondering if there's a much better way of doing this especially if I wish to do some easing.
link to fla
Adding Easing To This Script
How can I add easing to this script?
class CenteredMC extends MovieClip {
public var o_listener:Object ;
public function CenteredMC() {
Stage.align = "TL" ;
Stage.scaleMode = "noScale" ;
this.o_listener = new Object() ;
var owner = this ;
this.o_listener.onResize = function() {
owner.CenterMovieClip() ;
};
}
public function onLoad() {
Stage.addListener(this.o_listener) ;
this.CenterMovieClip() ;
}
public function CenterMovieClip():Void {
this._x = Math.round((Stage.width/2)-(this._width/2));
this._y = Math.round((Stage.height/2)-(this._height/2));
}
}
this is the rollover script:
on (rollOver) {
this._xscale = 200;
this._yscale = 200;
for (name in _root) {
if (typeof (_root[name]) == "movieclip" && _root[name] != this) {
if (_root[name]._x>this._x) {
_root[name]._x += _root.diff;
} else {
_root[name]._x -= _root.diff;
}
}
}
}
on (rollOut) {
_root.reset();
this._xscale = 100;
this._yscale = 100;
}
I have no clue. ;(
Adding A Callback To Easing Proto
From layer51.com/proto I've found a number of easing prototypes all of which are controlled by:
Code:
MovieClip.prototype.ease = function() {
this.e_time++;
if (this.e_time<=this.e_dur) {
arguments[1] == null ? arguments[1]=arguments[0] : null;
if (typeof arguments[0] == "number") {
arguments[0] = _global.e_types[arguments[0]];
arguments[1] = _global.e_types[arguments[1]];
}
this._x = _global[arguments[0]](this.e_time, this.e_oldX, this.e_newX, this.e_dur);
this._y = _global[arguments[1]](this.e_time, this.e_oldY, this.e_newY, this.e_dur);
}
};
In my movie I've set up a function that calls it:
Code:
org.TTS.ClickGUI.prototype.easeIn = function (tarClip) {
this=tarClip;
var dur = 20;
initEase(this, dur, 100, 100, 0, 0);
this.onEnterFrame = function() {
this.ease_scale(12,12);
}
};
I'd like to understand how to set up a callback procedure so that after the easing is completed, a followup function would fire. I imagine that part of the answer is add a RETURN on the ELSE side of the 'if (this.e_time<=this.e_dur) {' test but I'm not clear on other requirements.
Adding Easing To A Rotation Function?
I have the following code:
Code:
function rotate(mc, dest){
mc.onEnterFrame = function() {
this._rotation = dest;
if (Math.round(this._rotation) == [dest]) {
trace("rotating done");
this.onEnterFrame = undefined;
}
}
}
That moves the MC all at once, but how would I modify this so that it rotated and eased out?
Thanks in advance.
Adding Easing To Scroll Components?
I am using a standard Macromedia scroll pane component for some scrolling content. Is it possible to change some code in the component to make it ease when it scrolls? What i mean by "easing" is instead of just immediately snapping to its new position, it has a little bit of a delay as it slides into place. An example would be the text boxes here http://www.hdbuttercup.com/
Adding Easing To Scroll Components?
I am using a standard Macromedia scroll pane component for some scrolling content. Is it possible to change some code in the component to make it ease when it scrolls? What i mean by "easing" is instead of just immediately snapping to its new position, it has a little bit of a delay as it slides into place. An example would be the text boxes here http://www.hdbuttercup.com/
[F8] Adding Easing To Menu OnMouseUp
Hey guys,
I've got an interface that has horizontal line of thumbnails. When I click a left or right arrow the line of thumbnails moves either right or left respectively. This all works fine using the following code:
Code:
var mouseListener:Object = new Object();
Mouse.addListener(mouseListener);
var moving:Boolean = false;
mouseListener.onMouseDown = function()
{
moving = true;
panelOver();
}
mouseListener.onMouseUp = function()
{
moving = false;
panelUp();
}
function panelOver()
{
this.onEnterFrame = scrollPanel;
}
function panelUp()
{
delete this.onEnterFrame;
}
function scrollPanel()
{
if ((left.hitTest(_root._xmouse, _root._ymouse, true)) || (right.hitTest(_root._xmouse, _root._ymouse, true)))
{
for (var i=0; i<numOfItems; i++)
{
var t:MovieClip = home["item"+i];
var xdist = _xmouse - Stage.width/2;
t._x += -xdist / 2;
}
}
}
What I want though is on the MouseUp event for the menu to gradually slow rather than stop dead. So I want to apply easing to it. I've tried implementing some easing equations to no avail.
Can anyone point me in the right direction?
Many thanks
Matt
[F8] Adding Easing To Non-button Scroller
Hallo, I'm pretty new to actionscript so please bear with me...
I'm using this non-button scroller code, with all the values changed to make it vertical instead of horizontal. It works perfectly but I want to make the motion smoother so when you mouse over the scroll area it accelerates into the scroll and when you mouse off it decelerates to a stop. Any help appreciated
Adding Easing To HitTest Movement
Hey Kirupa people..
I need a little help here: I've got a simple setup of to movieclips on stage, mc_1 and mc_2.
ActionScript Code:
var theX = 120;var theY = 90;this.onEnterFrame = function() {if(mc_1.hitTest(_root._xmouse, _root._ymouse, true)){ mc_2._x = theX+((-_xmouse+theX)*(mc_2._width-mc_1._width)/mc_1._width); mc_2._y = theY+((-_ymouse+theY)*(mc_2._height-mc_1._height)/mc_1._height); } }
When you rollover mc_1, mc_2 start to move arcording to the x_- and _ymouse, I would like to add some easing to this movement - can this be done?
I've been messing around with += but I can't quite figure it out..
Any help would be nice..
Adding Easing To A Scrollable Image.
I'm trying to add easing motion to an object that is scrollable. I'm aware of the tweenclass functions and how to use them on objects, I'm just not sure on the coding for adding it to this code. So any help would be greatly appreciated. Thanks again.
Here's the code I'm using for the movie clip.
Code:
scrolling = function () {
var scrollHeight:Number = scrollTrack._height;
var contentHeight:Number = contentMain._height;
var scrollFaceHeight:Number = scrollFace._height;
var maskHeight:Number = maskedView._height;
var initPosition:Number = scrollFace._y=scrollTrack._y;
var initContentPos:Number = contentMain._y;
var finalContentPos:Number = maskHeight-contentHeight+initContentPos;
var left:Number = scrollTrack._x;
var top:Number = scrollTrack._y;
var right:Number = scrollTrack._x;
var bottom:Number = scrollTrack._height-scrollFaceHeight+scrollTrack._y;
var dy:Number = 0;
var speed:Number = 10;
var moveVal:Number = (contentHeight-maskHeight)/(scrollHeight-scrollFaceHeight);
scrollFace.onPress = function() {
var currPos:Number = this._y;
startDrag(this, false, left, top, right, bottom);
this.onMouseMove = function() {
dy = Math.abs(initPosition-this._y);
contentMain._y = Math.round(dy*-1*moveVal+initContentPos);
};
};
scrollFace.onMouseUp = function() {
stopDrag();
delete this.onMouseMove;
};
btnUp.onPress = function() {
this.onEnterFrame = function() {
if (contentMain._y+speed<maskedView._y) {
if (scrollFace._y<=top) {
scrollFace._y = top;
} else {
scrollFace._y -= speed/moveVal;
}
contentMain._y += speed;
} else {
scrollFace._y = top;
contentMain._y = maskedView._y;
delete this.onEnterFrame;
}
};
};
btnUp.onDragOut = function() {
delete this.onEnterFrame;
};
btnUp.onRollOut = function() {
delete this.onEnterFrame;
};
btnDown.onPress = function() {
this.onEnterFrame = function() {
if (contentMain._y-speed>finalContentPos) {
if (scrollFace._y>=bottom) {
scrollFace._y = bottom;
} else {
scrollFace._y += speed/moveVal;
}
contentMain._y -= speed;
} else {
scrollFace._y = bottom;
contentMain._y = finalContentPos;
delete this.onEnterFrame;
}
};
};
btnDown.onRelease = function() {
delete this.onEnterFrame;
};
btnDown.onDragOut = function() {
delete this.onEnterFrame;
};
if (contentHeight<maskHeight) {
scrollFace._visible = false;
btnUp.enabled = false;
btnDown.enabled = false;
} else {
scrollFace._visible = true;
btnUp.enabled = true;
btnDown.enabled = true;
}
};
scrolling();
Adding Easing To An Mc That Is Replacing The Mouse
Swapping the cursor for an MC and then attaching that to the mouse for a game I'm buiding. Looking to see if there is way to add some easing to the mouse movement. Most examples i see here list a target and dividing that by 2, but in this case there is no target since its _x, _y is set by mouse position. Thanks.
Code:
Mouse.hide()
this.my_mc.onEnterFrame = function(){
this._x = _xmouse
this._y = _ymouse
Adding Blur To Easing Menu
Ive been playing with this code i found online,
Code:
Stage.scaleMode = "noScale";
this.createEmptyMovieClip("centerPoint", depth++);
centerPoint._x = sectionContainer.section1._x;
centerPoint._y = sectionContainer.section1._y;
var paddingX = sectionContainer._x;
var paddingY = sectionContainer._y;
function easeTo(sectionNumber) {
var sX = sectionContainer[sectionNumber]._x;
var sY = sectionContainer[sectionNumber]._y;
var endX = centerPoint._x-sX+paddingX;
var endY = centerPoint._y-sY+paddingY;
sectionContainer.onEnterFrame = function() {
this._x += (endX-this._x)/12;
this._y += (endY-this._y)/12;
};
}
for (var i = 1; i<=9; i++) {
this["button"+i].goSection = "section"+i;
this["button"+i].onRelease = function() {
easeTo(this.goSection);
};
}
but I was wondering how I could add some motion blur filtering to it so, it looked more dynamic when it moved between the eases. Is this easy of not? Ive been looking at Inan Olcer's motion blur code - http://www.inanyus.com/2005/09/flash...-actionscript2 - but to no avail.
so, any ideas please??
thanks
Slider To Scroll Thumbnail Mc W/ Buttons Inside...onRollover Text Moves With Slider
I'm using a slider to scroll a movieclip made up of thumbnail images that are buttons. When I put my mouse over each button, I want it the image to change from black and white to color, and for a text description to appear in one fixed location on the main stage. Right now the image change to color is working, and the text appears as well, BUT the text scrolls as well, since it's within the scrolling movieclip. I want the text to appear static at a fixed location of: x=-947 and y=65. HELP!!!
It should look similar to: http://www.ehdd.com
Here's my code:
for my movieclip:
onClipEvent (enterFrame) {
_root.scrollMC._x = -.295*(_root.slider.b);
}
for my slider (set to scroll along "path"):
on (press) {
startDrag(this, false, 4, 270, 802,270);
}
on (release, releaseOutside) {
stopDrag ();
}
onClipEvent (enterFrame) {
a = new Object();
a.y = this._y;
a.x = this._x;
_root.path.globalToLocal (a);
b = int(a.x*2);
}
Slider In Reverse - Typed Text Makes Slider Move...help?
http://www.kirupa.com/developer/mx/slider.htm
Great tutorial...thanks by the way
But I was just wondering if anyone knew how you would go about doing this kinda in reverse? In that you type the percentage number in the text box and the slider moves up to that number?
Thanks in advance for your help
Adding A Slider To A Navigations Bar
Hi.
Im wondering how i would go about adding a slider to a navigation bar.
I tried using the "mouse follow with easing" and just limiting it to one axis then adding the buttons under my the follow.
What i REALLY need to find out is how to get the slider or follow to stop at each button.
An example:www.disasterlabs.com
Do you add a certain code to the button on the "over" frame? Or is the slider totally seperate?
If anyone knows how i could go about doing this, please help
Thanks alot!
Adding Function To Slider
I have been using Flash for years, but am fairly new to advanced AS.
I have been asked to create a scrubber that starts in the middle and can be dragged both ways. As it is dragged, a sequence of images needs to be shown. Particularly, it needs to show a man gradually losing weight when dragging to the left, and gaining weight when going to the right. I already have the images, but need to know how to create this kind of scrubber. I've checked the tutorial at http://www.kirupa.com/developer/mx/slider.htm, but do not see the code in the FLA file that changes the numbers in the box below the slider.
Thanks for any help!
Adding A Slider To A Navigations Bar
Hi.
Im wondering how i would go about adding a slider to a navigation bar.
I tried using the "mouse follow with easing" and just limiting it to one axis then adding the buttons under my the follow.
What i REALLY need to find out is how to get the slider or follow to stop at each button.
An example:www.disasterlabs.com
Do you add a certain code to the button on the "over" frame? Or is the slider totally seperate?
If anyone knows how i could go about doing this, please help
Thanks alot!
Adding A Volume Slider
Im trying to add a volume slider to my website. Im using Flash 5. I tried following along with the help files but when I go to enter the action script for: on clip event--enter frame, I copied and pasted the code in and I keep getting an error saying "the action on the clipboard contains errors, actions with errors cannot be pasted into normal mode." Im just a beginner with code, so forgive my stupidity, Im more of a designer.
Thanks,
t5
Adding Easing To Attached Movie Clips
I've attached some MovieClips to the stage by looping through an array. (dreamarray) I'm trying now to add easing to each of these MovieClips. I found a tutorial, but can't seem to translate their tutorial over to my file. In the released() function...i am creating a temp variable "t" to hold each of my dream elements. The t.xPos and t.yPos are undefined when I trace them after clicking on them. I would appreciate any help!
Right now I have t.xPos = dream._x --- I'm sure this needs to be changed
import mx.utils.Delegate
import mx.transitions.Tween;
import mx.transitions.easing.*;
var numClouds:Number = 35;
var fl:Number = 250;
var gravity:Number = .5;
var vx:Number = 0;
var vy:Number = 0;
var vz:Number = 0;
var friction:Number = .97;
var vpX:Number = Stage.width / 2;
var vpY:Number = Stage.height / 2;
var vpY:Number = 400;
var home:MovieClip = this;
var dreamarray:Array = new Array();
dreamarray[0] = "dreamone";
dreamarray[1] = "dreamtwo";
dreamarray[2] = "dreamthree";
dreamarray[3] = "dreamfour";
dreamarray[4] = "dreamfive";
var dreamarrayX:Array = new Array();
dreamarrayX[0] = 0
dreamarrayX[1] = -1800;
dreamarrayX[2] = 2000;
dreamarrayX[3] = 100;
dreamarrayX[4] = -1700;
var dreamarrayZ:Array = new Array();
dreamarrayZ[0] = 0;
dreamarrayZ[1] = 500;
dreamarrayZ[2] = 1000;
dreamarrayZ[3] = 1500;
dreamarrayZ[4] = 2000;
function init() {
for (var i:Number = 0; i<dreamarray.length; i++) {
var dream:MovieClip = attachMovie(dreamarray, "dreamarray" + i, i);
//var dream:MovieClip = attachMovie("dreamone", "dreamone" + i, i);
//dream.x = Math.random() * 1600 - 800 + dreamoffset;
dream.x = dreamarrayX;
dream.y = 50;
dream.z = dreamarrayZ;
dream.onPress = released;
}
}
function inittwo() {
//set Number to more than number of dreams
for (var j:Number = 20; j<numClouds; j++) {
var cloud:MovieClip = attachMovie("cloud", "cloud" + j, j);
//tree.x = 400;
cloud.x = Math.random() * 2000 - 800;
cloud.y = 50;
cloud.z = 0 + cloudoffset;
cloudoffset += 600;
}
}
function released() {
for (var i=0;i<dreamarray.length;i++){
//var t:MovieClip = home["dreamarray"+i];
var t:MovieClip = dreamarray;
//These t. values are undefined when I click on one of the attached dreamarray MovieClips
t.xPos = dream._x;
t.yPos = dream._y;
t.theScale = dream._xscale;
if (dream != this._parent)
{
var tw:Tween = new Tween(t, "._x", Strong.easeOut, t._x, 300, 100, true);
}
trace(t);
trace(t.xPos);
trace(t.yPos);
}
}
function onEnterFrame():Void {
//if (dreamarray4.z >= 500 && Key.isDown(Key.UP)){
if (zdepth < 55 && Key.isDown(Key.UP)){
vz -= 1;
zdepth += 1;
}
//if(dreamarray4.z >=2000 && Key.isDown(Key.DOWN))
if(zdepth > 0 && Key.isDown(Key.DOWN))
{
vz += 1;
zdepth -= 1;
}
//Killed side to side motion
/*if(Key.isDown(Key.LEFT ) )
{
vx += 1;
}
if(Key.isDown(Key.RIGHT))
{
vx -= 1;
}
if(Key.isDown(Key.SPACE))
{
vy += 1;
}
*/
vy -= gravity;
vx *= friction;
vy *= friction;
vz *= friction;
for (var i:Number=0;i<dreamarray.length;i++) {
//i think there is a error here
var dream:MovieClip = this["dreamarray" +i];
dream.x += vx;
dream.y += vy;
dream.z += vz;
if(dream.y < 50)
{
dream.y = 50;
vy = 0;
}
/*if (dream.z <= -fl) {
//delete dream.z
dream.z_visible = false;
}
else if(dream.z > 3000 - fl)
{
dream.z._visible = true;
}
*/
if (dream.z <= -fl) {
//delete dream.z
dream.z._visible = false;
}
else
{
dream.z._visible = true;
var scale:Number = fl / (fl + dream.z);
dream._xscale = dream._yscale = scale*100;
dream._x = vpX + dream.x * scale/2;
dream._y = vpY + dream.y * scale/2;
//dream._x = dream.x * scale/2;
dream._alpha = scale * 60 + 40;
dream.swapDepths(-dream.z);
}
}
for (var j:Number=0;j<numClouds;j++) {
var cloud:MovieClip = this["cloud" + j];
cloud.x += vx;
cloud.y += vy;
cloud.z += vz;
if(cloud.y < 50)
{
cloud.y = 50;
vy = 0;
}
if (cloud.z <= -fl) {
cloud.z += 5000;
}
else if(cloud.z > 5000 - fl)
{
cloud.z -= 5000;
}
var scale:Number = fl / (fl + cloud.z);
cloud._xscale = cloud._yscale=scale*200;
cloud._x = vpX + cloud.x * scale;
cloud._y = vpY + cloud.y * scale;
cloud._alpha = scale * 60 + 40;
cloud.swapDepths(-cloud.z);
}
}
init();
inittwo();
stop();
Adding Easing To Scrolling Movie Clip...
I'm trying to adding easing to a movie clip that is scrollable. I'm not quite sure on the exact coding needed to do this, So any help would be greatly appreciated. Thanks again.
Here's the code I'm using for the movie clip.
Code:
scrolling = function () {
var scrollHeight:Number = scrollTrack._height;
var contentHeight:Number = contentMain._height;
var scrollFaceHeight:Number = scrollFace._height;
var maskHeight:Number = maskedView._height;
var initPosition:Number = scrollFace._y=scrollTrack._y;
var initContentPos:Number = contentMain._y;
var finalContentPos:Number = maskHeight-contentHeight+initContentPos;
var left:Number = scrollTrack._x;
var top:Number = scrollTrack._y;
var right:Number = scrollTrack._x;
var bottom:Number = scrollTrack._height-scrollFaceHeight+scrollTrack._y;
var dy:Number = 0;
var speed:Number = 10;
var moveVal:Number = (contentHeight-maskHeight)/(scrollHeight-scrollFaceHeight);
scrollFace.onPress = function() {
var currPos:Number = this._y;
startDrag(this, false, left, top, right, bottom);
this.onMouseMove = function() {
dy = Math.abs(initPosition-this._y);
contentMain._y = Math.round(dy*-1*moveVal+initContentPos);
};
};
scrollFace.onMouseUp = function() {
stopDrag();
delete this.onMouseMove;
};
btnUp.onPress = function() {
this.onEnterFrame = function() {
if (contentMain._y+speed<maskedView._y) {
if (scrollFace._y<=top) {
scrollFace._y = top;
} else {
scrollFace._y -= speed/moveVal;
}
contentMain._y += speed;
} else {
scrollFace._y = top;
contentMain._y = maskedView._y;
delete this.onEnterFrame;
}
};
};
btnUp.onDragOut = function() {
delete this.onEnterFrame;
};
btnUp.onRollOut = function() {
delete this.onEnterFrame;
};
btnDown.onPress = function() {
this.onEnterFrame = function() {
if (contentMain._y-speed>finalContentPos) {
if (scrollFace._y>=bottom) {
scrollFace._y = bottom;
} else {
scrollFace._y += speed/moveVal;
}
contentMain._y -= speed;
} else {
scrollFace._y = bottom;
contentMain._y = finalContentPos;
delete this.onEnterFrame;
}
};
};
btnDown.onRelease = function() {
delete this.onEnterFrame;
};
btnDown.onDragOut = function() {
delete this.onEnterFrame;
};
if (contentHeight<maskHeight) {
scrollFace._visible = false;
btnUp.enabled = false;
btnDown.enabled = false;
} else {
scrollFace._visible = true;
btnUp.enabled = true;
btnDown.enabled = true;
}
};
scrolling();
Adding Easing Tween -- To Exisiting Function
Adding Easing Tween -- to exisiting function
Ok so I found this nice code over at Prototype. Its a function for Aligning to stage on Resize. http://proto.layer51.com/d.aspx?f=1514
It works really nice on its own but I was hoping to add some tweened easing as an additional optional parameter. (I posted there twice asking for help to no avail =( So I am asking here at Kirupa, hoping someone can help me with my struggles. What I wish to add is - implementing and adding an "easing" function as part of the current function. Something generalized to be called only if desired and the ability to set the ease type, duration, maybe prop etc.. (or whatever needed to make it work )
I have tried all kinds of things and below is as close as I can come (at least the only thing I can do to get the thing to move, although as you will see it works backwards and I can only get it to work using stage.width, stage.height, however I have tried newX oldX and all kinds of other things and cant seem to get things to move.
I am missing something, perhaps everything
Code:
// Original Script found here --
// Functions: Align to stage on Resize -- http://proto.layer51.com/d.aspx?f=1514
// +++ Stage Align +++
// onR function is used with fullscreen & "T(op)L(eft)" Stage.align as a ref point!!!
//fscommand( "fullscreen", true ); // <<-- Optional if needed
import mx.transitions.Tween;
import mx.transitions.easing.*;
Stage.scaleMode = "noScale";
Stage.align = "TL";
// Optional Easing -- I am trying to add with no success =(
function mover(obj:MovieClip, startX:Number, startY:Number, endX:Number, endY:Number) {
var tweenX:Tween = new Tween(obj, "_x", Regular.easeInOut, startX, endX, 1, true);
var tweenY:Tween = new Tween(obj, "_y", Regular.easeInOut, startY, endY, 1, true);
}
// trigger alignment via Stage listener object!
// alignment options: "TL", "TR", "TC", "BL", "BR", "BC", "CL", "CR", "CC"
// optional offset by X or Y axis provided as an object property: obj.X, obj.Y
function onR(A, obj) {
var F = String(A).substring(0, 1);
var L = String(A).substring(1, 2);
(obj.X == undefined) ? obj.X=0 : obj.X=obj.X;
(obj.Y == undefined) ? obj.Y=0 : obj.Y=obj.Y;
if (F == "T") {
obj._y = Math.ceil(obj.Y);
} else if (F == "B") {
obj._y = Math.ceil(Stage.height-obj._height-obj.Y);
} else if (F == "C") {
obj._y = Math.ceil((Stage.height-obj._height)/2-obj.Y);
}
if (L == "L") {
obj._x = Math.ceil(obj.X);
} else if (L == "R") {
obj._x = Math.ceil(Stage.width-obj._width-obj.X);
} else if (L == "C") {
obj._x = Math.ceil((Stage.width-obj._width)/2-obj.X);
}
}
//Usage
// ... later
// -- OPTIONAL positioning - to add further positioning of items if needed
mc_1.X = 100;
// X offset for mc_1 used for Center Left alignment
mc_2.Y = -50;
// Y offset for mc_2 used for Center Right alignment
var resizeListener:Object = new Object();
resizeListener.onResize = function() {
onR("CL", mc_1);
onR("CR", mc_2);
// Optional Easing Call to mover function -- I am trying to add with no success =(
// I know its set to stage center now but with all my efforts, this is the only senerio
// I can get anything to move, I tried newX old X etc.. this. and on and on.. can
// someone be so kind to help me add an "optional" workable easing function to this
// script? Mucho Apreciato to anyone that does ;-)
mover(mc_1, mc_1._x, mc_1._y, Math.round(Stage.width/2), Math.round(Stage.height/2));
mover(mc_2, mc_2._x, mc_2._y, Math.round(Stage.width/2), Math.round(Stage.height/2));
};
Stage.addListener(resizeListener);
// also the 2 mcs have registration in upper left etc..
I am open to suggestions on implementation, I just thought this function from prototype was pretty slick really and wanted to add some easing to it. It should be possible, I just cant get my head wrapped around it.
Can anyone please provide some help? I really appreciate your input people Thanks for your help.
__________
Simplify What I am asking:
http://proto.layer51.com/d.aspx?f=1514
Add easing to the above function found at that link (also posted above) on browser resize, so any MCs using the align function ease to there new location instead of just snapping into place.
Thanks everyone
Adding Easing Tween -- To Exisiting Function
Adding Easing Tween -- to exisiting function
Ok so I found this nice code over at Prototype. Its a function for Aligning to stage on Resize.
http://proto.layer51.com/d.aspx?f=1514
It works really nice on its own but I was hoping to add some tweened easing as an additional optional parameter. (I posted there twice asking for help to no avail =( So I am asking here at GTAL, hoping someone can help me with my struggles. What I wish to add is - implementing and adding an "easing" function as part of the current function. Something generalized to be called only if desired and the ability to set the ease type, duration, maybe prop etc.. (or whatever needed to make it work :( )
I have tried all kinds of things and below is as close as I can come (at least the only thing I can do to get the thing to move, although as you will see it works backwards and I can only get it to work using stage.width, stage.height, however I have tried newX oldX and all kinds of other things and cant seem to get things to move.
I am missing something, perhaps everything :D
Code:
// Original Script found here --
// Functions: Align to stage on Resize -- http://proto.layer51.com/d.aspx?f=1514
// +++ Stage Align +++
// onR function is used with fullscreen & "T(op)L(eft)" Stage.align as a ref point!!!
//fscommand( "fullscreen", true ); // <<-- Optional if needed
import mx.transitions.Tween;
import mx.transitions.easing.*;
Stage.scaleMode = "noScale";
Stage.align = "TL";
// Optional Easing -- I am trying to add with no success =(
function mover(obj:MovieClip, startX:Number, startY:Number, endX:Number, endY:Number) {
var tweenX:Tween = new Tween(obj, "_x", Regular.easeInOut, startX, endX, 1, true);
var tweenY:Tween = new Tween(obj, "_y", Regular.easeInOut, startY, endY, 1, true);
}
// trigger alignment via Stage listener object!
// alignment options: "TL", "TR", "TC", "BL", "BR", "BC", "CL", "CR", "CC"
// optional offset by X or Y axis provided as an object property: obj.X, obj.Y
function onR(A, obj) {
var F = String(A).substring(0, 1);
var L = String(A).substring(1, 2);
(obj.X == undefined) ? obj.X=0 : obj.X=obj.X;
(obj.Y == undefined) ? obj.Y=0 : obj.Y=obj.Y;
if (F == "T") {
obj._y = Math.ceil(obj.Y);
} else if (F == "B") {
obj._y = Math.ceil(Stage.height-obj._height-obj.Y);
} else if (F == "C") {
obj._y = Math.ceil((Stage.height-obj._height)/2-obj.Y);
}
if (L == "L") {
obj._x = Math.ceil(obj.X);
} else if (L == "R") {
obj._x = Math.ceil(Stage.width-obj._width-obj.X);
} else if (L == "C") {
obj._x = Math.ceil((Stage.width-obj._width)/2-obj.X);
}
}
//Usage
// ... later
// -- OPTIONAL positioning - to add further positioning of items if needed
mc_1.X = 100;
// X offset for mc_1 used for Center Left alignment
mc_2.Y = -50;
// Y offset for mc_2 used for Center Right alignment
var resizeListener:Object = new Object();
resizeListener.onResize = function() {
onR("CL", mc_1);
onR("CR", mc_2);
// Optional Easing Call to mover function -- I am trying to add with no success =(
// I know its set to stage center now but with all my efforts, this is the only senerio
// I can get anything to move, I tried newX old X etc.. this. and on and on.. can
// someone be so kind to help me add an "optional" workable easing function to this
// script? Mucho Apreciato to anyone that does ;-)
mover(mc_1, mc_1._x, mc_1._y, Math.round(Stage.width/2), Math.round(Stage.height/2));
mover(mc_2, mc_2._x, mc_2._y, Math.round(Stage.width/2), Math.round(Stage.height/2));
};
Stage.addListener(resizeListener);
// also the mcs have reg in upper left etc...
I am open to suggestions on implementation, I just thought this function from prototype was pretty slick really and wanted to add some easing to it. It should be possible, I just cant get my head wrapped around it. :?
Can anyone please provide some help? I really appreciate your input people Thanks for your help :)
Adding Easing And Tweening To A Xml Photo Gallery W/actionscript
I'm pretty new to alot of this and I was wondering if anyone knows how to add some tweens and some easing with actionsscript to make this xml photogallery look smoother. here is the link the tutorial is on.
http://www.kirupa.com/developer/mx2004/thumbnails.htm
Kirupa's Adding Thumbnail Tutorial With Easing Thumbs
Hi everybody,
I'm new to the forum and i would like some help.
I was learning how to add thumbnails to a photo slideshow from kirupa's tutorial: adding thumbnails, but i would like to learn how to add some easing to the thumbnail when scrolled.
What I want to learn is something like this:
http://www.phpjabbers.com/flash-gallery/
I've tried several things, i found something similar to what i want in this forum, but it didn't work. I try the tutorials on kirupa's web site about easing, but nothing...
here is the link for kirupa's tutorial:
http://www.kirupa.com/developer/mx2004/thumbnails.htm
and this one is the link for what i found in this forum:
http://www.kirupa.com/forum/showthre...mbnails+easing
Well, someone could help me?
Thanks in advance
Adding Easing To (both Ends Of) A Mouse-controlled Sliding Menu?
This is my first posting here, so bear with me
I have build a mouse-controlled sliding menu like the one on http://www.flashlevel.com. (On their site they have 3 of them actually) My menu is just horizontal instead of vertical.
Does anybody know how to add easing in both ends of a menu like that?? I use this script in frame 1:
fscommand("allowscale", "false");
fscommand("showmenu", "false");
fscommand("fullscreen", "false");
xpicture = 0;
film = 300;
scrollmovement = 5;
picture_width = 705;
name = "";
scroll = 1;
and this code in frame 2:
if (scroll == 1) {
xmouse = _xmouse-(film/2);
speed = (xmouse)/scrollmovement;
if (speed<0) {
speed = -(speed);
}
if (xmouse<0) {
xpicture = xpicture+speed;
}
if (xmouse>0) {
xpicture = xpicture-speed;
}
}
and in frame 3:
if (xpicture>0) {
xpicture = 0;
}
if (xpicture<-(picture_width-film)) {
xpicture = -(picture_width-film);
}
setProperty("pictures", _x, xpicture);
I hope someone can tell me how to do it.
thanks anyway
cheers Jonas
Adding Easing To (both Ends Of) A Mouse-controlled Sliding Menu?
Hi, I really hope someone can help me with this
I have build a mouse-controlled sliding menu like the one on http://www.flashlevel.com (On their website they have 3 of them actually) My menu is just horizontal instead of vertical.
Does anybody know how to add easing in both ends of a menu? I use this script in frame 1:
fscommand("allowscale", "false");
fscommand("showmenu", "false");
fscommand("fullscreen", "false");
xpicture = 0;
film = 300;
scrollmovement = 5;
picture_width = 705;
name = "";
scroll = 1;
and this code in frame 2:
if (scroll == 1) {
xmouse = _xmouse-(film/2);
speed = (xmouse)/scrollmovement;
if (speed<0) {
speed = -(speed);
}
if (xmouse<0) {
xpicture = xpicture+speed;
}
if (xmouse>0) {
xpicture = xpicture-speed;
}
}
and in frame 3:
if (xpicture>0) {
xpicture = 0;
}
if (xpicture<-(picture_width-film)) {
xpicture = -(picture_width-film);
}
setProperty("pictures", _x, xpicture);
I hope someone can tell me how to do it. I can attach the fla, if someone would have a look at it.
thanks anyway
cheers Jonas
Adding Easing To (both Ends Of) A Mouse-controlled Sliding Menu?
Hi, I really hope someone can help me with this
I have build a mouse-controlled sliding menu like the one on http://www.flashlevel.com (On their website they have 3 of them actually) My menu is just horizontal instead of vertical.
Does anybody know how to add easing in both ends of a menu? I use this script in frame 1:
fscommand("allowscale", "false");
fscommand("showmenu", "false");
fscommand("fullscreen", "false");
xpicture = 0;
film = 300;
scrollmovement = 5;
picture_width = 705;
name = "";
scroll = 1;
and this code in frame 2:
if (scroll == 1) {
xmouse = _xmouse-(film/2);
speed = (xmouse)/scrollmovement;
if (speed<0) {
speed = -(speed);
}
if (xmouse<0) {
xpicture = xpicture+speed;
}
if (xmouse>0) {
xpicture = xpicture-speed;
}
}
and in frame 3:
if (xpicture>0) {
xpicture = 0;
}
if (xpicture<-(picture_width-film)) {
xpicture = -(picture_width-film);
}
setProperty("pictures", _x, xpicture);
I hope someone can tell me how to do it. I can attach the fla, if someone would have a look at it.
thanks anyway
cheers Jonas
Easing Text
can anyone point me to a good tutorial on how to ease text in a scroll pane, or scroll bar
Easing Text Box...
Hey all,
Have you seen those 'easing' text boxes on some web sites?
I would like to know if theres a tutorail on the net on how to make them before a take a shot at making it my self.
i googled it but nothing really came up...
my text will by dynamicailly loaded so i would think i'd use the maxscroll paramter to get me the max end of the text field that link a scroll bar's x axis to proportionally scroll the text box. am i on the right track.
Easing Text Box...
Hey all,
Have you seen those 'easing' text boxes on some web sites?
I would like to know if theres a tutorail on the net on how to make them before a take a shot at making it my self.
i googled it but nothing really came up...
my text will by dynamicailly loaded so i would think i'd use the maxscroll paramter to get me the max end of the text field that link a scroll bar's x axis to proportionally scroll the text box. am i on the right track.
Easing Text Area
i want to make a text area that moves with easing, i will be using pixel fonts so it needs to move on whole pixel coordinates. At the moment i'm using a scrollbar to move it but this could just as easily be buttons. I know that i need to place the text area inside an mc and target this mc but beyond that i'm stumpted, any help would be much appreciated.
Easing Text In Scrollbar
I saw nice Easing text in scrollbar in lot of flash sites.
Exist some tutorial for this?
Do you know what i mean?
If no I will found some example.
Easing Text Window
can someone show me how to make a scrolling text box like this one:
http://free.onebyonedesign.com/
I have one that loads text through actionscript and the arrows work and all, but I would really like the scrollbar as well as the easing effect. Thanks.
Easing Text Scroller
Hi Guys. Hope someone can help.
I've been using the same easing text scroller on my projects for a few months now and it works fine, but I've just noticed (after looking at other sites) that the one I'm using isn't very smooth. but when I scroll I find that the text changes between clear and fuzzy, even if I use pixel fonts? I can understand why but I've been looking at some which dont go fuzzy at all.
Does anyone know any tips for a good easing scroller that keeps the text clear or point me to a tutorial/fla file?
Is it something in the script to say only move in integres so that the text stays clear??
Thanks guys. Phil
Dynamic Text In Easing
When I use an easing menu I can't use dynamic text to improve my font. When I use it dynamic it's gone . The easing still works but there isn't any text on it. That isn't a problem if the entire site had static text. But i've used only dynamic text and then it looks crummy. Is there a way to still use dynamic text in my easing?
Easing Text In Scrollbar
I saw nice Easing text in scrollbar in lot of flash sites.
Exist some tutorial for this?
Do you know what i mean?
If no I will found some example.
Dynamic Text 'easing'
i would really like to learn how to make scrollable text 'ease' up and down. an example would be the news section of the 2210 media site (http://www.2210media.com/main/flash.html). if anyone could point me in the direction of a tutorial, that would be great. also, would it require a special text scroller to be created? just curious...
thanks!
trig
Scripted Easing Text
I'm looking for a way to program some sliding text - slides to the center of the stage, pauses for a second then slides down off-stage while a new line of text slides to the center of the stage. Rinse and repeat. I would like to loop a certain number of these text clips indefintely.
Here's what I have so far - using the Tween class and setInterval but I'm open to any slick scripted solution. The more over the text movement and timing of the clips the better. Note that there's a 3 second delay before the text enters the stage:
http://www.tornedgedesign.com/_test/...ease_text.html
Work files:
http://www.tornedgedesign.com/_test/kirupa/ease.zip
Dynamic Text In Easing
When I use an easing menu I can't use dynamic text to improve my font. When I use it dynamic it's gone . The easing still works but there isn't any text on it. That isn't a problem if the entire site had static text. But i've used only dynamic text and then it looks crummy. Is there a way to still use dynamic text in my easing?
|