Jump to content
Search Community

Ebrahim Naderlou

Members
  • Posts

    8
  • Joined

  • Last visited

Ebrahim Naderlou's Achievements

1

Reputation

  1. hi how to access to an event click of BTN that used in a MC which used of scroll? Archive.zip
  2. 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; } };
  3. 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; } };
  4. i think you did not get me i took the codes of ThrowPropsPlugin because i did not get the exact result . so i sent you the file for you to say me how to use ThrowPropsPlugin for scrolling .
  5. But I couldn't attach my zip file Because i didn't find attach button
  6. 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.
  7. Hi I need me a scroll and a grid for Android SimplyGreen account you bought But could not find I need it Help please
×
×
  • Create New...