Re: [Flashcoders] Flash8 Question
Now, the question is 1. how can I loop through all movie clip by code? 2. how can I change the on hover effect only? Ibrahim On Mon, Mar 31, 2008 at 4:59 AM, Pedro Taranto [EMAIL PROTECTED] wrote: laurent wrote: If I remember right you must create a Color object for your mac, then use color method setRGB to change the mc's tint to the hexadecimal you want: var c:Color = new Color( yourMC ); c.setRGB( 0xff ); L Ibrahim Y a écrit : Hello folks, I have the following case, I have a lot of movie clips, they have a lot of effect separately (i.e. each movieclip has it's own effect on hover, on press ...etc) most effect implemented in design not in code. what I want to ask about, most movie clips have on hover effect that change it's color to orange, is there a way in code that can change this property to red for example instead change this effect for each movie clip. Thanks. Ibrahim Color class is deprecated, you should use ColorTransform and Tranform classes ex: var myTransform : Transform = new Transform(myMc); var myColor : ColorTransform = new ColorTransform(); myColor.rgb = 0x262626; //apply the color myMc.colorTransform = myColor; -- Pedro Taranto ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Root casting as Main big problem
hm...the MovieClip( root ) help to compile with no error. But then trying to acces a method of the root throw an error about: TypeError: Error #1010: Un terme n'est pas défini et n'a pas de propriété. term undefined...it can't find the object referenced so I casted the object I'm trying to acces from root: import org.lf.PreLoader; trace(PreLoader( MovieClip( root ).pl )); trace(PreLoader( MovieClip( root ).pl ).lxl); var mc:MovieClip = MovieClip( root ).pl.lxl; if( MovieClip( root ).ready[ mc ] ){ mc.launch(); }else{ MovieClip( root ).ready[ mc ] = true; } and the trace return null for the first one and then throw an error because it can't find anything. Do I have to make a swc ?? thx L laurent a écrit : Thanks for the precise answer, I got the book, will have a look tom and try the MovieClip workaround. Now I will bang my head on sweeter stuff ;) thx L jonathan howe a écrit : I think you might be able to get around this by using a swc, which can be checked for classes by the complier without actually including it in the swf. Do you have Moock's Essential Actionscript 3.0? Chapter 31 details the various ways you can do it, all based on which authoring tool you're using. A little much for me to repeat in email. -jonathan On Fri, Mar 28, 2008 at 11:10 AM, laurent [EMAIL PROTECTED] wrote: Hi, It's very urgent, try to make it clear: I have one MovieClip index.swf, with a Main.as class attch to it. In this class I define properties and method, of course :) And I load external movieclip, one name content.swf in this content swf I need to talk with rootand I cast it with Main( root ).myproperty The problem when I publish this mc is looking for the Main class and check if element are there, for exemple some linked moviclip, but they are in the index library. so I can copy all needed asset in the content library, and perhaps it will fixe it but I will have all content duplicated...so is there a workaround ?? Thanks for any urgent help! ;) L ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Flash8 Question
You can name you boutons a gneric name: btn_0, btn_1, btn_2, etc then you have a loop: for( i = 0; i buttonNumber; i ++){ var mc:MovieClip = this[btn_ + i]; mc.onhoverMC do something with it } this code is in the buttons container. L Ibrahim Y a écrit : Now, the question is 1. how can I loop through all movie clip by code? 2. how can I change the on hover effect only? Ibrahim On Mon, Mar 31, 2008 at 4:59 AM, Pedro Taranto [EMAIL PROTECTED] wrote: laurent wrote: If I remember right you must create a Color object for your mac, then use color method setRGB to change the mc's tint to the hexadecimal you want: var c:Color = new Color( yourMC ); c.setRGB( 0xff ); L Ibrahim Y a écrit : Hello folks, I have the following case, I have a lot of movie clips, they have a lot of effect separately (i.e. each movieclip has it's own effect on hover, on press ...etc) most effect implemented in design not in code. what I want to ask about, most movie clips have on hover effect that change it's color to orange, is there a way in code that can change this property to red for example instead change this effect for each movie clip. Thanks. Ibrahim Color class is deprecated, you should use ColorTransform and Tranform classes ex: var myTransform : Transform = new Transform(myMc); var myColor : ColorTransform = new ColorTransform(); myColor.rgb = 0x262626; //apply the color myMc.colorTransform = myColor; -- Pedro Taranto ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Flash8 Question
the movie clips already created, and everything is fine. but I want to change them all using code, I don't want to rename them all, in this case I can change the design manually. On Mon, Mar 31, 2008 at 8:41 AM, laurent [EMAIL PROTECTED] wrote: You can name you boutons a gneric name: btn_0, btn_1, btn_2, etc then you have a loop: for( i = 0; i buttonNumber; i ++){ var mc:MovieClip = this[btn_ + i]; mc.onhoverMC do something with it } this code is in the buttons container. L Ibrahim Y a écrit : Now, the question is 1. how can I loop through all movie clip by code? 2. how can I change the on hover effect only? Ibrahim On Mon, Mar 31, 2008 at 4:59 AM, Pedro Taranto [EMAIL PROTECTED] wrote: laurent wrote: If I remember right you must create a Color object for your mac, then use color method setRGB to change the mc's tint to the hexadecimal you want: var c:Color = new Color( yourMC ); c.setRGB( 0xff ); L Ibrahim Y a écrit : Hello folks, I have the following case, I have a lot of movie clips, they have a lot of effect separately ( i.e. each movieclip has it's own effect on hover, on press ...etc) most effect implemented in design not in code. what I want to ask about, most movie clips have on hover effect that change it's color to orange, is there a way in code that can change this property to red for example instead change this effect for each movie clip. Thanks. Ibrahim Color class is deprecated, you should use ColorTransform and Tranform classes ex: var myTransform : Transform = new Transform(myMc); var myColor : ColorTransform = new ColorTransform(); myColor.rgb = 0x262626; //apply the color myMc.colorTransform = myColor; -- Pedro Taranto ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Flash8 Question
the name I'm talking about is the name you give in the properties panel. when you click a mc you can specify is name on the stage that is totally something else from is name in the library. So there you should choose a name that help you loop through the mcs Ibrahim Y a écrit : the movie clips already created, and everything is fine. but I want to change them all using code, I don't want to rename them all, in this case I can change the design manually. On Mon, Mar 31, 2008 at 8:41 AM, laurent [EMAIL PROTECTED] wrote: You can name you boutons a gneric name: btn_0, btn_1, btn_2, etc then you have a loop: for( i = 0; i buttonNumber; i ++){ var mc:MovieClip = this[btn_ + i]; mc.onhoverMC do something with it } this code is in the buttons container. L Ibrahim Y a écrit : Now, the question is 1. how can I loop through all movie clip by code? 2. how can I change the on hover effect only? Ibrahim On Mon, Mar 31, 2008 at 4:59 AM, Pedro Taranto [EMAIL PROTECTED] wrote: laurent wrote: If I remember right you must create a Color object for your mac, then use color method setRGB to change the mc's tint to the hexadecimal you want: var c:Color = new Color( yourMC ); c.setRGB( 0xff ); L Ibrahim Y a écrit : Hello folks, I have the following case, I have a lot of movie clips, they have a lot of effect separately ( i.e. each movieclip has it's own effect on hover, on press ...etc) most effect implemented in design not in code. what I want to ask about, most movie clips have on hover effect that change it's color to orange, is there a way in code that can change this property to red for example instead change this effect for each movie clip. Thanks. Ibrahim Color class is deprecated, you should use ColorTransform and Tranform classes ex: var myTransform : Transform = new Transform(myMc); var myColor : ColorTransform = new ColorTransform(); myColor.rgb = 0x262626; //apply the color myMc.colorTransform = myColor; -- Pedro Taranto ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Re: How to take screenshot of sites , as seen on snap.com
JavaScript and CSS --- Thuy Nguyen Web Developer Angus Productions Inc. On Mar 30, 2008, at 11:03 AM, flashcoders- [EMAIL PROTECTED] wrote: Send Flashcoders mailing list submissions to flashcoders@chattyfig.figleaf.com To subscribe or unsubscribe via the World Wide Web, visit http://chattyfig.figleaf.com/mailman/listinfo/flashcoders or, via email, send a message with subject or body 'help' to [EMAIL PROTECTED] You can reach the person managing the list at [EMAIL PROTECTED] When replying, please edit your Subject line so it is more specific than Re: Contents of Flashcoders digest... Today's Topics: 1. How to take screenshot of sites , as seen on snap.com (Digg Yeah) -- Message: 1 Date: Sun, 30 Mar 2008 19:29:56 +0530 From: Digg Yeah [EMAIL PROTECTED] Subject: [Flashcoders] How to take screenshot of sites , as seen on snap.com To: flashcoders@chattyfig.figleaf.com Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-1 Not sure if this is the right place to ask this, but can anybody share a pointer to how snap.com capture sceenshot of sites? Any help would be much appreciated. Thank you for your time. -- ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders End of Flashcoders Digest, Vol 6, Issue 48 ** ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] TextField.bottomScroll
Hi list... I'm encountering a weird scenario where a TextField's bottom scroll isn't being reported accurately. It's tracing a number less what it actually. The end of the text in my TF was /r/r/r/r, and now I've populated it to be something like /rtext/rtext/rtext/rtext, thinking that would force the real value, but it's still inaccurate. Anyone ever encounter this? Thanks, - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] TextField.bottomScroll (part 2)
Why?? // c is a TextField c.scroll = this.lastVisibleLine; // 338 var firstLineOnPage = c.scroll; // 326 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] TextField.bottomScroll
yeh - put a bunch of br /'s in at the end because of this - i thought it was only html dynamic text that did this but i guess not. Never found a solution a On 31 Mar 2008, at 14:05, Mendelsohn, Michael wrote: Hi list... I'm encountering a weird scenario where a TextField's bottom scroll isn't being reported accurately. It's tracing a number less what it actually. The end of the text in my TF was /r/r/r/r, and now I've populated it to be something like /rtext/rtext/rtext/rtext, thinking that would force the real value, but it's still inaccurate. Anyone ever encounter this? Thanks, - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] AS2 SOAP web service
Hi everybody, I'm having some trouble with connecting to a SOAP web service from my AS2 app. I need to log in on the web service to use it, but I don't know when I should use the login/pass. I use this script: var service:WebService = new WebService( url ); var call:PendingCall = service.doSomething(); call.onResult = function( result:XML ) { trace( result ); }; call.onFault = function( fault:SOAPFault ) { trace(Webservice fault: + fault.faultcode + , + fault.faultstring ); } When I run it on my local machine there's no problem, but when I run it from our server a html dialog appears and I get a SOAPFault. Any suggestions? Cheers, Gert-Jan ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Flash8 Question - contrast transform
Yep, a BitmapFilter is what you need. You might want to check out TweenFilterLite for an easy way to apply (and/or tween) the filter. It'll also let you adjust saturation, brightness, colorization, hue, and threshold. www.TweenFilterLite.com The code would look something like: TweenFilterLite.to(my_mc, 0.5, {colorMatrixFilter:{contrast:2}}); Jack -Original Message- From: Pedro Taranto [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2008 12:17 AM To: Flash Coders List Subject: Re: [Flashcoders] Flash8 Question - contrast transform laurent wrote: Hm...I should play with colors again. How do we change the contrast or brightness of a color ? using HSV ?? or is there a straight way using colorTransformin AS3 or AS2. thx L you should apply some BitmapFilter -- Pedro Taranto ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] AS3 MouseEvent target?
hi guys in actionscript 3, if i put a mouse event on a movieclip object containing a textfield, should the mouse event be on the movieclip or the textfield? here's my code (comments added to see where the problem is occurring) CODE private function createPeriodBar(dateStart:int, dateEnd:int, pbTitle:String, pbDate:String, pbList:Array = null):void { var pixelStart:int = yearsToPixels(dateStart); var pixelEnd:int = yearsToPixels(dateEnd); var pbX:int = pixelStart; var pbWidth:int = pixelEnd - pixelStart; var pbYStart:int = taTitleBarHeight + pbSpace; // sets the starting point for all periodBars var pbY:int = pbYStart + pbGetY(dateStart, dateEnd) * (pbHeight +pbSpace); // pbGetY is a separate function that automatically stacks the periodBars where they will fit without overlapping var pb:MovieClip = new MovieClip(); // was a sprite but sprites cannot have strings attached to them, eg my rolloverText variable if (uint(dateEnd-dateStart) 1) // if the difference between the start and end dates is more than 1 { pb.graphics.beginFill(0xFF,.3); pb.graphics.drawRoundRect(0,0,pbWidth,pbHeight,pbHeight); pb.graphics.endFill(); pb.x = pbX; pb.y = pbY; var pbText:SimpleTextField = new SimpleTextField(0xFF, 14, headingFont, 4, -2, pbWidth-4, 25, pbTitle, false); pbText.selectable = false; // tried making this non-selectable but it hasn't helped pbText.text += ; pbText.text += pbDate; var pbf:TextFormat = new TextFormat(); pbf.font= subheadingFont; pbf.size= 10; var pbCurrentLength = pbTitle.length+1; var pbDateLength= pbText.length; pbText.setTextFormat(pbf, pbCurrentLength, pbDateLength); pb.addChild(pbText); } else { // will create a dot instead of a box containing text if it will otherwise be too small to render a roundrect pb.graphics.beginFill(0xFF,.5); pb.graphics.drawCircle(0,0,pbHeight/2); pb.graphics.endFill(); pb.x = pbX; pb.y = pbY+(pbHeight/2); } pb.rolloverText = pbTitle + /n + pbDate; pb.addEventListener(MouseEvent.MOUSE_OVER, pbMouseOverListener); scrollableBase.addChild(pb); } private function pbMouseOverListener(e:MouseEvent):void { mfTextField.text = e.target.rolloverText; // mfTextField is a textfield within a mousefollower trace (e.target); // traces simpleTextField if over a movieclip with a simpletextfield in otherwise traces movieclip trace (e.target.rolloverText); // gives error when over a simpletextfield but works properly when over a movieclip without, eg where the dates are too close and a dot is rendered instead mouseFollower.visible = true; } because the movieclip isn't always the target (even tho i've set the mouseevent on the movieclip), i can't consistently get a reading from rolloverText (because it's trying to find the variable rolloverText in the pbText SimpleTextField) can anyone explain why this is and what i can do to get around it please? thanks a lot a Allandt Bik-Elliott thefieldcomic.com e [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] AS3 MouseEvent target?
hi guys in actionscript 3, if i put a mouse event on a movieclip object containing a textfield, should the mouse event be on the movieclip or the textfield? here's my code (comments added to see where the problem is occurring) CODE private function createPeriodBar(dateStart:int, dateEnd:int, pbTitle:String, pbDate:String, pbList:Array = null):void { var pixelStart:int = yearsToPixels(dateStart); var pixelEnd:int = yearsToPixels(dateEnd); var pbX:int = pixelStart; var pbWidth:int = pixelEnd - pixelStart; var pbYStart:int = taTitleBarHeight + pbSpace; // sets the starting point for all periodBars var pbY:int = pbYStart + pbGetY(dateStart, dateEnd) * (pbHeight +pbSpace); // pbGetY is a separate function that automatically stacks the periodBars where they will fit without overlapping var pb:MovieClip = new MovieClip(); // was a sprite but sprites cannot have strings attached to them, eg my rolloverText variable if (uint(dateEnd-dateStart) 1) // if the difference between the start and end dates is more than 1 { pb.graphics.beginFill(0xFF,.3); pb.graphics.drawRoundRect(0,0,pbWidth,pbHeight,pbHeight); pb.graphics.endFill(); pb.x = pbX; pb.y = pbY; var pbText:SimpleTextField = new SimpleTextField(0xFF, 14, headingFont, 4, -2, pbWidth-4, 25, pbTitle, false); pbText.selectable = false; // tried making this non-selectable but it hasn't helped pbText.text += ; pbText.text += pbDate; var pbf:TextFormat = new TextFormat(); pbf.font= subheadingFont; pbf.size= 10; var pbCurrentLength = pbTitle.length+1; var pbDateLength= pbText.length; pbText.setTextFormat(pbf, pbCurrentLength, pbDateLength); pb.addChild(pbText); } else { // will create a dot instead of a box containing text if it will otherwise be too small to render a roundrect pb.graphics.beginFill(0xFF,.5); pb.graphics.drawCircle(0,0,pbHeight/2); pb.graphics.endFill(); pb.x = pbX; pb.y = pbY+(pbHeight/2); } pb.rolloverText = pbTitle + /n + pbDate; pb.addEventListener(MouseEvent.MOUSE_OVER, pbMouseOverListener); scrollableBase.addChild(pb); } private function pbMouseOverListener(e:MouseEvent):void { mfTextField.text = e.target.rolloverText; // mfTextField is a textfield within a mousefollower trace (e.target); // traces simpleTextField if over a movieclip with a simpletextfield in otherwise traces movieclip trace (e.target.rolloverText); // gives error when over a simpletextfield but works properly when over a movieclip without, eg where the dates are too close and a dot is rendered instead mouseFollower.visible = true; } because the movieclip isn't always the target (even tho i've set the mouseevent on the movieclip), i can't consistently get a reading from rolloverText (because it's trying to find the variable rolloverText in the pbText SimpleTextField) can anyone explain why this is and what i can do to get around it please? thanks a lot a Allandt Bik-Elliott thefieldcomic.com e [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 MouseEvent target?
mc.mouseChildren = false; or event.currentTarget ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 MouseEvent target?
Try setting mouseChildren to false Kenneth Kawamoto http://www.materiaprima.co.uk/ Allandt Bik-Elliott (Receptacle) wrote: hi guys in actionscript 3, if i put a mouse event on a movieclip object containing a textfield, should the mouse event be on the movieclip or the textfield? here's my code (comments added to see where the problem is occurring) CODE private function createPeriodBar(dateStart:int, dateEnd:int, pbTitle:String, pbDate:String, pbList:Array = null):void { var pixelStart:int = yearsToPixels(dateStart); var pixelEnd:int = yearsToPixels(dateEnd); var pbX:int = pixelStart; var pbWidth:int = pixelEnd - pixelStart; var pbYStart:int = taTitleBarHeight + pbSpace; // sets the starting point for all periodBars var pbY:int = pbYStart + pbGetY(dateStart, dateEnd) * (pbHeight+pbSpace); // pbGetY is a separate function that automatically stacks the periodBars where they will fit without overlapping var pb:MovieClip = new MovieClip(); // was a sprite but sprites cannot have strings attached to them, eg my rolloverText variable if (uint(dateEnd-dateStart) 1) // if the difference between the start and end dates is more than 1 { pb.graphics.beginFill(0xFF,.3); pb.graphics.drawRoundRect(0,0,pbWidth,pbHeight,pbHeight); pb.graphics.endFill(); pb.x = pbX; pb.y = pbY; var pbText:SimpleTextField = new SimpleTextField(0xFF, 14, headingFont, 4, -2, pbWidth-4, 25, pbTitle, false); pbText.selectable = false; // tried making this non-selectable but it hasn't helped pbText.text += ; pbText.text += pbDate; var pbf:TextFormat = new TextFormat(); pbf.font= subheadingFont; pbf.size= 10; var pbCurrentLength= pbTitle.length+1; var pbDateLength= pbText.length; pbText.setTextFormat(pbf, pbCurrentLength, pbDateLength); pb.addChild(pbText); } else { // will create a dot instead of a box containing text if it will otherwise be too small to render a roundrect pb.graphics.beginFill(0xFF,.5); pb.graphics.drawCircle(0,0,pbHeight/2); pb.graphics.endFill(); pb.x = pbX; pb.y = pbY+(pbHeight/2); } pb.rolloverText = pbTitle + /n + pbDate; pb.addEventListener(MouseEvent.MOUSE_OVER, pbMouseOverListener); scrollableBase.addChild(pb); } private function pbMouseOverListener(e:MouseEvent):void { mfTextField.text = e.target.rolloverText; // mfTextField is a textfield within a mousefollower trace (e.target); // traces simpleTextField if over a movieclip with a simpletextfield in otherwise traces movieclip trace (e.target.rolloverText); // gives error when over a simpletextfield but works properly when over a movieclip without, eg where the dates are too close and a dot is rendered instead mouseFollower.visible = true; } because the movieclip isn't always the target (even tho i've set the mouseevent on the movieclip), i can't consistently get a reading from rolloverText (because it's trying to find the variable rolloverText in the pbText SimpleTextField) can anyone explain why this is and what i can do to get around it please? thanks a lot a Allandt Bik-Elliott thefieldcomic.com e [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 MouseEvent target?
A perfect opportunity for someone more eloquent than I to explain event bubbling. On Mon, Mar 31, 2008 at 4:17 PM, Allandt Bik-Elliott (Receptacle) [EMAIL PROTECTED] wrote: hi guys in actionscript 3, if i put a mouse event on a movieclip object containing a textfield, should the mouse event be on the movieclip or the textfield? here's my code (comments added to see where the problem is occurring) CODE private function createPeriodBar(dateStart:int, dateEnd:int, pbTitle:String, pbDate:String, pbList:Array = null):void { var pixelStart:int = yearsToPixels(dateStart); var pixelEnd:int = yearsToPixels(dateEnd); var pbX:int = pixelStart; var pbWidth:int = pixelEnd - pixelStart; var pbYStart:int = taTitleBarHeight + pbSpace; // sets the starting point for all periodBars var pbY:int = pbYStart + pbGetY(dateStart, dateEnd) * (pbHeight +pbSpace); // pbGetY is a separate function that automatically stacks the periodBars where they will fit without overlapping var pb:MovieClip = new MovieClip(); // was a sprite but sprites cannot have strings attached to them, eg my rolloverText variable if (uint(dateEnd-dateStart) 1) // if the difference between the start and end dates is more than 1 { pb.graphics.beginFill(0xFF,.3); pb.graphics.drawRoundRect (0,0,pbWidth,pbHeight,pbHeight); pb.graphics.endFill(); pb.x = pbX; pb.y = pbY; var pbText:SimpleTextField = new SimpleTextField(0xFF, 14, headingFont, 4, -2, pbWidth-4, 25, pbTitle, false); pbText.selectable = false; // tried making this non-selectable but it hasn't helped pbText.text += ; pbText.text += pbDate; var pbf:TextFormat = new TextFormat(); pbf.font= subheadingFont; pbf.size= 10; var pbCurrentLength = pbTitle.length+1; var pbDateLength= pbText.length; pbText.setTextFormat(pbf, pbCurrentLength, pbDateLength); pb.addChild(pbText); } else { // will create a dot instead of a box containing text if it will otherwise be too small to render a roundrect pb.graphics.beginFill(0xFF,.5); pb.graphics.drawCircle(0,0,pbHeight/2); pb.graphics.endFill(); pb.x = pbX; pb.y = pbY+(pbHeight/2); } pb.rolloverText = pbTitle + /n + pbDate; pb.addEventListener(MouseEvent.MOUSE_OVER, pbMouseOverListener); scrollableBase.addChild(pb); } private function pbMouseOverListener(e:MouseEvent):void { mfTextField.text = e.target.rolloverText; // mfTextField is a textfield within a mousefollower trace (e.target); // traces simpleTextField if over a movieclip with a simpletextfield in otherwise traces movieclip trace (e.target.rolloverText); // gives error when over a simpletextfield but works properly when over a movieclip without, eg where the dates are too close and a dot is rendered instead mouseFollower.visible = true; } because the movieclip isn't always the target (even tho i've set the mouseevent on the movieclip), i can't consistently get a reading from rolloverText (because it's trying to find the variable rolloverText in the pbText SimpleTextField) can anyone explain why this is and what i can do to get around it please? thanks a lot a Allandt Bik-Elliott thefieldcomic.com e [EMAIL PROTECTED] ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 MouseEvent target?
IMO, explaining Event Bubbling as the reason the TextField is the target is complicating the immediate solution he needs, which is mouseChildren = false. Yes, it's Event Bubbling that's causing the target to be the TextField. To understand Event Bubbling, read about it in the docs, or better yet, in a book (like Moock's). But, then you MUST do it yourself to learn how it works. If you don't play with it yourself, you will never get it no matter how much somebody explains it to you. I'm fully convinced of that. You gotta mess around with it to fully understand why it's so amazingly awesome. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 MouseEvent target?
You shouldn't be using capture phase until you've got a really good handle on bubbling phase first. You shouldn't have bubbling turned on for your button unless you are planning on catching this event above this clip, as well. Event Bubbling means that the TextField is dispatching a bubbling event automatically and you are catching it because you're listening to the clip that contains the TextField for the CLICK event. You're going to receive the TextField CLICK even though you want just the MovieClip CLICK. You set mouseChildren = false so you don't receive events from anything but the MovieClip. Take off the true flag for bubbling and set mouseChildren = true. This should solve your issue. Allandt Bik-Elliott (Receptacle) wrote: okay i've tried everything i can find in the book re: this problem and it doesn't seem to be having any affect i've tried the mouseChildren option (commented out) and useCapture tomfoolery (seems to be firing in the CAPTURING_PHASE as that's the only one i can get any result from) and i've also tried separating the graphic elements from the container displayobject to get rid of any code wierdness. I've even tried putting the solid block on top of the text and applying the event to that but none of it has worked. here is my code (with eventphase extra bits in place): private function createPeriodBar(dateStart:int, dateEnd:int, pbTitle:String, pbDate:String, pbList:Array = null):void { var pixelStart:int = yearsToPixels(dateStart); var pixelEnd:int = yearsToPixels(dateEnd); var pbX:int = pixelStart; var pbWidth:int = pixelEnd - pixelStart; var pbYStart:int = taTitleBarHeight + pbSpace; var pbY:int = pbYStart + pbGetY(dateStart, dateEnd) * (pbHeight+pbSpace); var pbcontainer:MovieClip = new MovieClip(); var pb:Shape = new Shape(); if (uint(dateEnd-dateStart) 1) { pb.graphics.beginFill(0xFF,.3);// white 50% alpha pb.graphics.drawRoundRect(0,0,pbWidth,pbHeight,pbHeight); pb.graphics.endFill(); pbcontainer.x = pbX; pbcontainer.y = pbY; var pbText:SimpleTextField = new SimpleTextField(0xFF, 14, headingFont, 4, -2, pbWidth-4, 25, pbTitle, false); pbText.selectable = false; pbText.text += ; pbText.text += pbDate; var pbf:TextFormat = new TextFormat(); pbf.font= subheadingFont; pbf.size= 10; var pbCurrentLength= pbTitle.length+1; var pbDateLength= pbText.length; pbText.setTextFormat(pbf, pbCurrentLength, pbDateLength); pbcontainer.addChild(pbText); pbcontainer.addChild(pb); //pb.mouseChildren = false; // } else { pb.graphics.beginFill(0xFF,.5);// white 50% alpha pb.graphics.drawCircle(0,0,pbHeight/2); pb.graphics.endFill(); pbcontainer.x = pbX; pbcontainer.y = pbY+(pbHeight/2); pbcontainer.addChild(pb); } pbcontainer.rolloverText = pbTitle + \n + pbDate; pbcontainer.addEventListener(MouseEvent.CLICK, pbMouseOverListener, true); // changed to click to make it easier to track scrollableBase.addChild(pbcontainer); } private function pbMouseOverListener(e:MouseEvent):void { if (e.eventPhase == EventPhase.CAPTURING_PHASE) { mfTextField.text = e.target.rolloverText; trace (e.target.rolloverText); mouseFollower.visible = true; } } really hope you can help because i'm stumped (and it's 12.15 am ;) ) a On 31 Mar 2008, at 23:20, Allandt Bik-Elliott (Receptacle) wrote: i have the moock book but i couldn't get my head round the bubbling phase and how it affected me - i need to look into it a bit more i added mouseChildren=false but it made the entire event stop - even on the objects that were working before, and i didn't even get the error is this because i've drawn directly in the sprite? here's what i did: private function createPeriodBar(dateStart:int, dateEnd:int, pbTitle:String, pbDate:String, pbList:Array = null):void { var pixelStart:int = yearsToPixels(dateStart); var pixelEnd:int = yearsToPixels(dateEnd); var pbX:int = pixelStart; var pbWidth:int = pixelEnd - pixelStart; var pbYStart:int = taTitleBarHeight + pbSpace; var pbY:int = pbYStart +
Re: [Flashcoders] AS3 MouseEvent target?
Take off the true flag for bubbling and set mouseChildren = true. This should solve your issue. Er, I meant set mouseChildren = false. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders