Jump to content
Search Community

scroll & grid

Ebrahim Naderlou test
Moderator Tag

Recommended Posts

Hi

 

Sorry to hear you are having troubles.

I am having difficulty understanding what scroll and grid is.

Can you please provide a link to a page or example on our site that shows what you are trying to do or use?

 

We will do our best to help you.

Link to comment
Share on other sites

Hi


Thnx a lot for your help


I have bought ThrowPropsPlugin but i have some problem as follows and i need your help


 


1- I can't use of this plugin for following cases 


---scrolling TLFTextFild that I put inside an object because in this case the whole of object is scrolling in spite of i want to scroll TLFTextFild separately, if is it possible pls send me sample code.


Link to comment
Share on other sites

Sorry, I'm not quite sure what that means.

I never used TLFText and from what I understand it has been deprecated and completely removed from Flash CC, so if this is a problem with TLFText specifically, I'm not sure how much help I can be. 

 

My only guess is that you are trying to drag an element that has scrollable text and you need to make sure that you can interact with scrollbars inside something you are dragging. In that case I would suggest that you make sure the clickable / draggable element is stacked beneath the textfield in the display list. 

 

If you are having a problem with ThrowPropsPlugin, feel free to create a very simple fla that clearly illustrates the issue. You can zip the fla and attach it here, just be sure to not include the GreenSock files.

Link to comment
Share on other sites

Thank you for the file.

I'm not exactly sure what I'm supposed to do with it though. I did not see any instructions or code related to ThrowPropsPlugin anywhere.

import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.utils.ByteArray;
import flash.net.FileReference;


import com.greensock.*;
import com.greensock.plugins.*;
import com.greensock.easing.*; 
/////////////////////////
estandard1_fehrest1_btn.addEventListener(MouseEvent.CLICK,fun_estandard1_fehrest1_btn);
/////////////////////////
var _n:Number;
var _boolean:Number;


var myXML:XML;
var estandard_text:_khabarText;

var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("estandard.xml"));
myLoader.addEventListener(Event.COMPLETE, processXML);
function processXML(e:Event):void
{

myXML = new XML(e.target.data);
}
////////////////////////


function fun_estandard1_fehrest1_btn(e:Event):void
{


_n = 7;
fun_text_standard1_fehrest();
// fun_visibleFalse_estandard1_fehrest_btn();
}
////////////////////////


function fun_text_standard1_fehrest():void
{

estandard_text = new _khabarText();
var estandard_textX:Number = 0;
var estandard_textY:Number = 200;


estandard_text.y = estandard_textY;
estandard_text.x = estandard_textX;
estandard_text.khabarText_txt.text = myXML.estandard1[_n]. @ fehrest;


addChild(estandard_text);

_boolean = 1;
}

I think we are just having a communication problem due to a language barrier.

I wish I could be of more assistance.

Link to comment
Share on other sites

The request for a sample file was to help me better understand what you want. 

I took a guess at what you may want in Post #4, but you did not respond.

 

I think for scrollable text that you can flick, the best way to start is to use the sample code that is provided on the ThrowProps page in the Flick-scrolling example.

 

You can just paste that code directly into your Fla

 

import com.greensock.*; 
import com.greensock.easing.*;
import com.greensock.plugins.*;
import flash.geom.Rectangle;
import flash.utils.getTimer;
import flash.events.MouseEvent;
import flash.text.*;
import flash.display.*;
TweenPlugin.activate([ThrowPropsPlugin]);


var bounds:Rectangle = new Rectangle(30, 30, 250, 230);
var mc:Sprite = new Sprite();
addChild(mc);
setupTextField(mc, bounds);
var blitMask:BlitMask = new BlitMask(mc, bounds.x, bounds.y, bounds.width, bounds.height, false);


var t1:uint, t2:uint, y1:Number, y2:Number, yOverlap:Number, yOffset:Number;


blitMask.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);


function mouseDownHandler(event:MouseEvent):void {
TweenLite.killTweensOf(mc);
y1 = y2 = mc.y;
yOffset = this.mouseY - mc.y;
yOverlap = Math.max(0, mc.height - bounds.height);
t1 = t2 = getTimer();
mc.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
mc.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
}


function mouseMoveHandler(event:MouseEvent):void {
var y:Number = this.mouseY - yOffset;
//if mc's position exceeds the bounds, make it drag only half as far with each mouse movement (like iPhone/iPad behavior)
if (y > bounds.top) {
mc.y = (y + bounds.top) * 0.5;
} else if (y < bounds.top - yOverlap) {
mc.y = (y + bounds.top - yOverlap) * 0.5;
} else {
mc.y = y;
}
blitMask.update();
var t:uint = getTimer();
//if the frame rate is too high, we won't be able to track the velocity as well, so only update the values 20 times per second
if (t - t2 > 50) {
y2 = y1;
t2 = t1;
y1 = mc.y;
t1 = t;
}
event.updateAfterEvent();
}


function mouseUpHandler(event:MouseEvent):void {
mc.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
mc.stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
var time:Number = (getTimer() - t2) / 1000;
var yVelocity:Number = (mc.y - y2) / time;
ThrowPropsPlugin.to(mc, {throwProps:{
y:{velocity:yVelocity, max:bounds.top, min:bounds.top - yOverlap, resistance:300}
}, onUpdate:blitMask.update, ease:Strong.easeOut
}, 10, 0.3, 1);
}


function setupTextField(container:Sprite, bounds:Rectangle, padding:Number=20):void {
var tf:TextField = new TextField();
tf.width = bounds.width - padding;
tf.x = tf.y = padding / 2;
tf.defaultTextFormat = new TextFormat("_sans", 12);
tf.text = "Click and drag this content and then let go as you're dragging to throw it. Notice how it smoothly glides into place, respecting the initial velocity and the maximum/minimum coordinates.\n\nThrowPropsPlugin allows you to simply define an initial velocity for a property (or multiple properties) as well as optional maximum and/or minimum end values and then it will calculate the appropriate landing position and plot a smooth course based on the easing equation you define (Quad.easeOut by default, as set in TweenLite). This is perfect for flick-scrolling or animating things as though they are being thrown.\n\nFor example, let's say a user clicks and drags a ball and you track its velocity using an ENTER_FRAME handler and then when the user releases the mouse button, you'd determine the velocity but you can't do a normal tween because you don't know exactly where it should land or how long the tween should last (faster initial velocity would mean a longer duration). You need the tween to pick up exactly where the user left off so that it appears to smoothly continue moving at the same velocity they were dragging and then decelerate based on whatever ease you define in your tween.\n\nAs demonstrated here, maybe the final resting value needs to lie within a particular range so that the content doesn't land outside a particular area. But you don't want it to suddenly jerk to a stop when it hits the edge; instead, you want it to ease gently into place even if that means going past the landing spot briefly and easing back (if the initial velocity is fast enough to require that). The whole point is to make it look smooth.\n\nThrowPropsPlugin isn't just for tweening x and y coordinates. It works with any numeric property, so you could use it for spinning the rotation of an object as well. Or the scaleX/scaleY properties. Maybe the user drags to spin a wheel and lets go and you want it to continue increasing the rotation at that velocity, decelerating smoothly until it stops.\n\nOne of the trickiest parts of creating a throwProps tween that looks fluid and natural, particularly if you're applying maximum and/or minimum values, is determining its duration. Typically it's best to have a relatively consistent level of resistance so that if the initial velocity is very fast, it takes longer for the object to come to rest compared to when the initial velocity is slower. You also may want to impose some restrictions on how long a tween can last (if the user drags incredibly fast, you might not want the tween to last 200 seconds). The duration will also affect how far past a max/min boundary the property can potentially go, so you might want to only allow a certain amount of overshoot tolerance. That's why ThrowPropsPlugin has a few static helper methods that make managing all these variables much easier. The one you'll probably use most often is the to() method which is very similar to TweenLite.to() except that it doesn't have a duration parameter and it adds several other optional parameters.\n\nA unique convenience of ThrowPropsPlugin compared to most other solutions out there which use ENTER_FRAME loops is that everything is reverseable and you can jump to any spot in the tween immediately. So if you create several throwProps tweens, for example, and dump them into a TimelineLite, you could simply call reverse() on the timeline to watch the objects retrace their steps right back to the beginning.\n\nThe overshootTolerance parameter sets a maximum number of seconds that can be added to the tween's duration (if necessary) to accommodate temporarily overshooting the end value before smoothly returning to it at the end of the tween. This can happen in situations where the initial velocity would normally cause it to exceed the max or min values. An example of this would be in the iOS (iPhone or iPad) when you flick-scroll so quickly that the content would shoot past the end of the scroll area. Instead of jerking to a sudden stop when it reaches the edge, the content briefly glides past the max/min position and gently eases back into place. The larger the overshootTolerance the more leeway the tween has to temporarily shoot past the max/min if necessary.";
tf.multiline = tf.wordWrap = true;
tf.selectable = false;
tf.autoSize = TextFieldAutoSize.LEFT;
container.addChild(tf);


container.graphics.beginFill(0xFFFFFF, 1);
container.graphics.drawRect(0, 0, tf.width + padding, tf.textHeight + padding);
container.graphics.endFill();
container.x = bounds.x;
container.y = bounds.y;


};

http://greensock.com/throwprops-as

Link to comment
Share on other sites

  • 2 weeks later...

Dear Carl

Thank you for your helping and spending your time for me in advance.

All my problems are solved but there is one thing yet the whole text does not scroll.

import com.greensock.*; 
import com.greensock.easing.*;
import com.greensock.plugins.*;
import flash.geom.Rectangle;
import flash.utils.getTimer;
import flash.events.MouseEvent;
import flash.text.*;
import flash.display.*;
TweenPlugin.activate([ThrowPropsPlugin]);

import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.utils.ByteArray;
import flash.net.FileReference;



var bounds:Rectangle = new Rectangle(-10, 30, 500, 1000);
var mc:Sprite = new Sprite();
addChild(mc);
setupTextField(mc, bounds);
var blitMask:BlitMask = new BlitMask(mc, bounds.x, bounds.y, bounds.width, bounds.height, false);


var t1:uint, t2:uint, y1:Number, y2:Number, yOverlap:Number, yOffset:Number;


blitMask.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);


function mouseDownHandler(event:MouseEvent):void {
TweenLite.killTweensOf(mc);
y1 = y2 = mc.y;
yOffset = this.mouseY - mc.y;
yOverlap = Math.max(0, mc.height - bounds.height);
t1 = t2 = getTimer();
mc.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
mc.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
}


function mouseMoveHandler(event:MouseEvent):void {
var y:Number = this.mouseY - yOffset;
//if mc's position exceeds the bounds, make it drag only half as far with each mouse movement (like iPhone/iPad behavior)
if (y > bounds.top) {
mc.y = (y + bounds.top) * 0.5;
} else if (y < bounds.top - yOverlap) {
mc.y = (y + bounds.top - yOverlap) * 0.5;
} else {
mc.y = y;
}
blitMask.update();
var t:uint = getTimer();
//if the frame rate is too high, we won't be able to track the velocity as well, so only update the values 20 times per second
if (t - t2 > 50) {
y2 = y1;
t2 = t1;
y1 = mc.y;
t1 = t;
}
event.updateAfterEvent();
}


function mouseUpHandler(event:MouseEvent):void {
mc.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
mc.stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
var time:Number = (getTimer() - t2) / 1000;
var yVelocity:Number = (mc.y - y2) / time;
ThrowPropsPlugin.to(mc, {throwProps:{
y:{velocity:yVelocity, max:bounds.top, min:bounds.top - yOverlap, resistance:300}
}, onUpdate:blitMask.update, ease:Strong.easeOut
}, 10, 0.3, 1);
}


function setupTextField(container:Sprite, bounds:Rectangle, padding:Number=20):void {
			
		var myXML:XML;
		var estandard_text:_khabarText;
		
		var myLoader:URLLoader = new URLLoader();
		myLoader.load(new URLRequest("estandard.xml"));
		myLoader.addEventListener(Event.COMPLETE, processXML);
		function processXML(e:Event):void
		{
		
		myXML = new XML(e.target.data);
		fun_text();
		}

		function fun_text():void
		{
		
		estandard_text = new _khabarText();
		var estandard_textX:Number = 0;
		var estandard_textY:Number = 200;
		
		
		estandard_text.y = estandard_textY;
		estandard_text.x = estandard_textX;
		estandard_text.khabarText_txt.text = myXML.estandard1[2]. @ fehrest;
		
		
//			var tf:TextField = new TextField();
//			tf.width = bounds.width - padding;
//			tf.x = tf.y = padding / 2;
//			tf.defaultTextFormat = new TextFormat("_sans", 12);
//			tf.text = "Click and drag thhoot past the max/min if necessary.";
//			tf.multiline = tf.wordWrap = true;
//			tf.selectable = false;
//			tf.autoSize = TextFieldAutoSize.LEFT;
//			container.addChild(tf);
			container.addChild(estandard_text.khabarText_txt);
			
			
			container.graphics.beginFill(0xFFFFFF, 1);
			container.graphics.drawRect(0, 0, estandard_text.khabarText_txt.width + padding, estandard_text.khabarText_txt.textHeight + padding);
			container.graphics.endFill();
			container.x = bounds.x;
			container.y = bounds.y;
			
			
			
			
}	

};



		

Link to comment
Share on other sites

Thank you I have solved my self

import com.greensock.*; 
import com.greensock.easing.*;
import com.greensock.plugins.*;
import flash.geom.Rectangle;
import flash.utils.getTimer;
import flash.events.MouseEvent;
import flash.text.*;
import flash.display.*;
TweenPlugin.activate([ThrowPropsPlugin]);

import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.utils.ByteArray;
import flash.net.FileReference;
import flashx.textLayout.formats.Direction;
import fl.motion.Color;
import flashx.textLayout.formats.BackgroundColor;




var bounds:Rectangle = new Rectangle(-10, 30, 480, 1000);
var mc:Sprite = new Sprite();
addChild(mc);
setupTextField(mc, bounds);
var blitMask:BlitMask = new BlitMask(mc, bounds.x, bounds.y, bounds.width, bounds.height, false);


var t1:uint, t2:uint, y1:Number, y2:Number, yOverlap:Number, yOffset:Number;


blitMask.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);


function mouseDownHandler(event:MouseEvent):void {
TweenLite.killTweensOf(mc);
y1 = y2 = mc.y;
yOffset = this.mouseY - mc.y;
yOverlap = Math.max(0, mc.height - bounds.height);
t1 = t2 = getTimer();
mc.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
mc.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
}


function mouseMoveHandler(event:MouseEvent):void {
var y:Number = this.mouseY - yOffset;
//if mc's position exceeds the bounds, make it drag only half as far with each mouse movement (like iPhone/iPad behavior)
if (y > bounds.top) {
mc.y = (y + bounds.top) * 0.5;
} else if (y < bounds.top - yOverlap) {
mc.y = (y + bounds.top - yOverlap) * 0.5;
} else {
mc.y = y;
}
blitMask.update();
var t:uint = getTimer();
//if the frame rate is too high, we won't be able to track the velocity as well, so only update the values 20 times per second
if (t - t2 > 50) {
y2 = y1;
t2 = t1;
y1 = mc.y;
t1 = t;
}
event.updateAfterEvent();
}


function mouseUpHandler(event:MouseEvent):void {
mc.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
mc.stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
var time:Number = (getTimer() - t2) / 1000;
var yVelocity:Number = (mc.y - y2) / time;
ThrowPropsPlugin.to(mc, {throwProps:{
y:{velocity:yVelocity, max:bounds.top, min:bounds.top - yOverlap, resistance:300}
}, onUpdate:blitMask.update, ease:Strong.easeOut
}, 10, 0.3, 1);
}


function setupTextField(container:Sprite, bounds:Rectangle, padding:Number=20):void {
			
		var myXML:XML;
		var estandard_text:_khabarText;
		
		var myLoader:URLLoader = new URLLoader();
		myLoader.load(new URLRequest("estandard.xml"));
		myLoader.addEventListener(Event.COMPLETE, processXML);
		function processXML(e:Event):void
		{
		
		myXML = new XML(e.target.data);
		fun_text();
		}

		function fun_text():void
		{
		
		estandard_text = new _khabarText();
		var estandard_textX:Number = 0;
		var estandard_textY:Number = 200;
		
		
		estandard_text.y = estandard_textY;
		estandard_text.x = estandard_textX;
		estandard_text.khabarText_txt.text = myXML.estandard1[6]. @ fehrest;
		
		var tt:String = estandard_text.khabarText_txt.text;
			var tf:TLFTextField = new TLFTextField();
			tf.width = bounds.width - padding;
			tf.x = tf.y = padding / 2;
			tf.defaultTextFormat = new TextFormat("_sans", 12);
			tf.text = tt;
			tf.direction=Direction.RTL;
			tf.multiline = tf.wordWrap = true;
			tf.selectable = false;
			tf.autoSize = TextFieldAutoSize.RIGHT;
			container.addChild(tf);
			//container.addChild(estandard_text.khabarText_txt);
			
			
			var _height:Number = tf.textHeight + 300;
//			txt.text = _height.toString();
			
			container.graphics.beginFill(0xFFFFFF, 1);
			container.graphics.drawRect(0, 0, estandard_text.khabarText_txt.width + padding, _height + padding);
			container.graphics.endFill();
			container.x = bounds.x;
			container.y = bounds.y;
			
			
			
			
}	

};



		

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

see attached.

I added code based on the this post and the file it used



import com.greensock.*; 
import com.greensock.easing.*;
import com.greensock.plugins.*;
import flash.geom.Rectangle;
import flash.utils.getTimer;
import flash.events.MouseEvent;
import flash.text.*;
import flash.display.*;
TweenPlugin.activate([ThrowPropsPlugin]);




var bounds:Rectangle = new Rectangle(30, 30, 550, 730);
var mc:Sprite = new Sprite();
addChild(mc);
setupTextField(mc, bounds);
var blitMask:BlitMask = new BlitMask(mc, bounds.x, bounds.y, bounds.width, bounds.height, true);
blitMask.bitmapMode = false;




var t1:uint, t2:uint, y1:Number, y2:Number, yOverlap:Number, yOffset:Number;
mc1.btn1.addEventListener(MouseEvent.MOUSE_DOWN, fun_btn1);
function fun_btn1(event:MouseEvent):void {
trace("clicked");
}
blitMask.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);




var mouseDownX:Number; //for recording the x position of the mouse when it is pressed
var mouseDownY:Number; //for recording the y position of the mouse when it is pressed
var clickedButton:DisplayObject; //for recording the button that is pressed








function mouseDownHandler(event:MouseEvent):void {
TweenLite.killTweensOf(mc);


 //now record the mouse position and button that's pressed
   mouseDownX = stage.mouseX;
   mouseDownY = stage.mouseY;
y1 = y2 = mc.y;


yOffset = this.mouseY - mc.y;
yOverlap = Math.max(0, mc.height - bounds.height);
t1 = t2 = getTimer();
mc.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
mc.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
}




function mouseMoveHandler(event:MouseEvent):void {
var y:Number = this.mouseY - yOffset;
//if mc's position exceeds the bounds, make it drag only half as far with each mouse movement (like iPhone/iPad behavior)
if (y > bounds.top) {
mc.y = (y + bounds.top) * 0.5;
} else if (y < bounds.top - yOverlap) {
mc.y = (y + bounds.top - yOverlap) * 0.5;
} else {
mc.y = y;
}
blitMask.update();
var t:uint = getTimer();
//if the frame rate is too high, we won't be able to track the velocity as well, so only update the values 20 times per second
if (t - t2 > 50) {
y2 = y1;
t2 = t1;
y1 = mc.y;
t1 = t;
}
event.updateAfterEvent();
}




function mouseUpHandler(event:MouseEvent):void {
mc.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
mc.stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);






  if (Math.abs(mouseDownX - stage.mouseX) < 3 && Math.abs(mouseDownY - stage.mouseY) < 3) {
      if(clickedButton){
   clickHandler(clickedButton);
 }
   }else{ 
clickedButton = null;
blitMask.bitmapMode = true;
var time:Number = (getTimer() - t2) / 1000;
var yVelocity:Number = (mc.y - y2) / time;
ThrowPropsPlugin.to(mc, {throwProps:{
y:{velocity:yVelocity, max:bounds.top, min:bounds.top - yOverlap, resistance:300}
}, onUpdate:blitMask.update, onComplete:throwComplete, ease:Strong.easeOut
}, 10, 0.3, 1);
}
}






// ****** NEW STUFF ******** //


function throwComplete() {
//re-enable interactivity of mc and child buttons
trace("throwComplete()");
blitMask.bitmapMode = false;
}


mc1.btn1.addEventListener(MouseEvent.MOUSE_DOWN, buttonDownHandler); 


function buttonDownHandler(event:MouseEvent):void{
clickedButton = event.target as DisplayObject;
trace("MOUSE_DOWN on " + clickedButton.name);
}




function clickHandler(button:DisplayObject):void {
trace("**** CLICK DETECTED ON " + button.name);
TweenLite.to(button, 1, {alpha:Math.random()});
// reset clickedButton to null so that another click outside of any button doesn't register the previously clicked button as being clicked again
clickedButton = null; 
}






function setupTextField(container:Sprite, bounds:Rectangle, padding:Number=20):void {
var tf:TextField = new TextField();
tf.width = bounds.width - padding;
tf.x = tf.y = padding / 2;
tf.defaultTextFormat = new TextFormat("_sans", 12);
tf.text = "Click and drag this content and then let go as you're dragging to throw it. Notice how it smoothly glides into place, respecting the initial velocity and the maximum/minimum coordinates.\n\nThrowPropsPlugin allows you to simply define an initial velocity for a property (or multiple properties) as well as optional maximum and/or minimum end values and then it will calculate the appropriate landing position and plot a smooth course based on the easing equation you define (Quad.easeOut by default, as set in TweenLite). This is perfect for flick-scrolling or animating things as though they are being thrown.\n\nFor example, let's say a user clicks and drags a ball and you track its velocity using an ENTER_FRAME handler and then when the user releases the mouse button, you'd determine the velocity but you can't do a normal tween because you don't know exactly where it should land or how long the tween should last (faster initial velocity would mean a longer duration). You need the tween to pick up exactly where the user left off so that it appears to smoothly continue moving at the same velocity they were dragging and then decelerate based on whatever ease you define in your tween.\n\nAs demonstrated here, maybe the final resting value needs to lie within a particular range so that the content doesn't land outside a particular area. But you don't want it to suddenly jerk to a stop when it hits the edge; instead, you want it to ease gently into place even if that means going past the landing spot briefly and easing back (if the initial velocity is fast enough to require that). The whole point is to make it look smooth.\n\nThrowPropsPlugin isn't just for tweening x and y coordinates. It works with any numeric property, so you could use it for spinning the rotation of an object as well. Or the scaleX/scaleY properties. Maybe the user drags to spin a wheel and lets go and you want it to continue increasing the rotation at that velocity, decelerating smoothly until it stops.\n\nOne of the trickiest parts of creating a throwProps tween that looks fluid and natural, particularly if you're applying maximum and/or minimum values, is determining its duration. Typically it's best to have a relatively consistent level of resistance so that if the initial velocity is very fast, it takes longer for the object to come to rest compared to when the initial velocity is slower. You also may want to impose some restrictions on how long a tween can last (if the user drags incredibly fast, you might not want the tween to last 200 seconds). The duration will also affect how far past a max/min boundary the property can potentially go, so you might want to only allow a certain amount of overshoot tolerance. That's why ThrowPropsPlugin has a few static helper methods that make managing all these variables much easier. The one you'll probably use most often is the to() method which is very similar to TweenLite.to() except that it doesn't have a duration parameter and it adds several other optional parameters.\n\nA unique convenience of ThrowPropsPlugin compared to most other solutions out there which use ENTER_FRAME loops is that everything is reverseable and you can jump to any spot in the tween immediately. So if you create several throwProps tweens, for example, and dump them into a TimelineLite, you could simply call reverse() on the timeline to watch the objects retrace their steps right back to the beginning.\n\nThe overshootTolerance parameter sets a maximum number of seconds that can be added to the tween's duration (if necessary) to accommodate temporarily overshooting the end value before smoothly returning to it at the end of the tween. This can happen in situations where the initial velocity would normally cause it to exceed the max or min values. An example of this would be in the iOS (iPhone or iPad) when you flick-scroll so quickly that the content would shoot past the end of the scroll area. Instead of jerking to a sudden stop when it reaches the edge, the content briefly glides past the max/min position and gently eases back into place. The larger the overshootTolerance the more leeway the tween has to temporarily shoot past the max/min if necessary.";
tf.multiline = tf.wordWrap = true;
tf.selectable = false;
tf.autoSize = TextFieldAutoSize.LEFT;
container.addChild(mc1);
//container.addChild(tf);




container.graphics.beginFill(0xFFFFFF, 1);
container.graphics.drawRect(0, 0, tf.width + padding, tf.textHeight + padding);
container.graphics.endFill();
container.x = bounds.x;
container.y = bounds.y;


};


blitmask-button.zip

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...