SEARCH YOUR SOLUTION HERE  

clicking on a sprite with a textfield child

kirupers!!!

I've been out of as3 for a few weeks but when I start coding again, I start coming back again to the forum

I have a movieclip in the library (menu_button) which only consists of a textfield. This is an item of a dynamic menu I build by adding new instances of the menu_button class.

It seems that when I click in the movieclip, it's the textfield that fires the mouse event, instead of the movieclip which contains the textfield.

Whe I do trace(event.target.type) I get "dynamic" (for dynamic textfield I supose...)

Another problem I have is that when I do menu_button.buttonMode= true I don't get that gloved hand we all love...

this should be simple... Am I missing something important

TIA!

Pier

Posted On: Thursday 25th of October 2012 11:06:41 PM Total Views:  397
View Complete with Replies




Related Messages:

Fade out audio clip when clicking a button?   (96 Views)
I have intro audio music playing on a project I am working on. The audio is in the timeline (but doesn't necessarily have to be), and when I click a button to move away from it, it just keeps playing. I can use SoundMixer.stop(); to make is stop as you click the button, but this makes a rather harsh abrupt stop to the music that is undeable. I would like to have it fade the audio track out once the button is clicked. Does anybody know how would I go about doing this
Flash rapid clicking - problem with the gallery   (99 Views)
Can someone tell me why rapid clicking (moving to another part of the gallery) makes the loader loads the wrong picture Here is a simple example: Code: var req:URLRequest=new URLRequest("gallery.xml"); var xmlLoader:URLLoader=new URLLoader(req); xmlLoader.addEventListener(Event.COMPLETE, xmlComplete); var myXML:XML; var urlArray:Vector. = new Vector.(); var i:int; var page:int; var xmlIndex:int; var wallIndex:int; var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, picComplete); function xmlComplete(e:Event):void { myXML=XML(xmlLoader.data); for (i=0; i
Flash How to make it start explode automatically instead of clicking on the button "Explode   (94 Views)
How to make it start explode automatically instead of clicking on the button "Explode Pixels" manually What kind of modifications required in such example codes I download to work automatically The following is the code: Code: import gs.TweenMax; import gs.easing.*; stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; var pixelContainer:MovieClip = new MovieClip(); var glow:GlowFilter = new GlowFilter(0xFFFF00, 1, 10, 10,5,2); var animating:Boolean=false; var pixelBMP:BitmapData; var i:int = 0; var j:int = 0; var xArray:Array = new Array(); var yArray:Array = new Array(); addChild(pixelContainer) pixelContainer.x=mcLogo.x; pixelContainer.y=mcLogo.y; pixelBMP=new BitmapData(mcLogo.width,mcLogo.height,true,0x000000) pixelBMP.draw(mcLogo) for(i = 0; i
How to make an object pop up then disappear when clicking a button in it.   (119 Views)
! first I'll introduce myself as this is my first post here. My name is Jason, username Bowserstein (after a character I like to draw). I am an artist and animator, and I like to work on my own websites for my portfolios, artwork, animations, and more. I am trying to learn more about flash to integrate into my web designing, and thus I came here for advice and help getting started. So, thank you all in advance! So, here is what I'm trying to do. I have a page full of characters for a project I'm working on now, and I want to add some interactivity to the page by making each of the characters clickable and having a description of the character pop up that you can then close. I have included 3 images of what I'd ideally like to happen. Picture 1: The page in just a normal state, nothing happening. Picture 2: On rollover, I would like the character to pop out and enlarge. I know how to make it enlarge on rollover, but I don't understand how you would make it come to the front above other layers. This I need help with understanding how to do. Picture 3: I want a description like this to pop up when you click on the character. I have a layer at 50% opacity to fade the background out as well. I need to know how to: 1. Make this image show up when you click on the respective character. 2. Make this image disappear when you click on the red X button at the top right. I think with a little help in learning how to do something like this once, I can easily repeat it for all the characters on the page. I am using Flash CS3 on Windows 7. Thank you all for your help in advance! Bowserstein
Change URL by clicking on the button (Flash/aspx)   (102 Views)
Hi all, I have a question which i hope to find it's answer here as usual I'm attaching a file which is so basic, it includes just a button What i want to do is when i click on this button it change the URL of an aspx page For example : The URL of the current page is http(remove this)://localhost:1030/Account/Game1.aspx when i click on the button i want the URL to be changed to http(remove this)://localhost:1030/Account/Game5.aspx I use AS3 and ASP.NET C# Anybody can help me with the Actionscript and the aspx code please, or is there a tutorial that i can follow to sort this out
hide an object on a keyframe by clicking an object on different keyframe?   (103 Views)
is it possible to hide an object on a keyframe by clicking an object on a different keyframe. im a super noob. was just wondering if its possible to click an object(movieclip) on one keyframe that will reveal something on another frame. i only started doing codes today so super duper new, iv just been using basic click mousevent visibilty=true etc etc but it only seems to work for objects on the same frame. simplest answer possible!
Flash5 Loading and Unloading External Swf when clicking Forward and Back?   (101 Views)
I am creating an interactive slideshow, like a PowerPoint effect, I have a main scene, 4 Buttons, a Home Button, Play Button, Forward Button & Back Button. I want the Home Button to take me back to the start of the scene, Forward Button to Load a External swf slide and when the Forward Button is clicked again to Unload External swf and load in the next swf slide, I also want the Back Button to do a similar thing! I keep getting External Swf pile-ups or flickering Here's my code: Code: Play_button1.addEventListener(MouseEvent.CLICK, Play_btn1); import fl.display.ProLoader; var fl_ProLoader:ProLoader; var fl_ToLoad:Boolean = true; function Play_btn1(event:MouseEvent):void { fl_ProLoader = new ProLoader(); fl_ProLoader.load(new URLRequest("slides/slide1.swf")); addChild(fl_ProLoader); fl_ProLoader .y = 36; } else { fl_ProLoader.unload(); removeChild(fl_ProLoader); fl_ProLoader = null; } // Toggle whether you want to load or unload the SWF fl_ToLoad = !fl_ToLoad; } Forward_button1.addEventListener(MouseEvent.CLICK, Forward_btn1); function Forward_btn1(event:MouseEvent):void { gotoAndStop("Slide2"); } Back_button1.addEventListener(MouseEvent.CLICK, Back_btn1); function Back_btn1(event:MouseEvent):void { gotoAndStop("Home"); } Home_button1.addEventListener(MouseEvent.CLICK, Home_btn1); function Home_btn1(event:MouseEvent):void { gotoAndStop("Home"); } I hope this all makes sense, any Help will be useful.
Glitch with too much clicking? In Flash application?   (97 Views)
I made an interactive flash application a few years ago that works as a sort of mini-operating system, and everything within it normally works fine - all the actionscript code is correct and relatively simple. However, sometimes when something is clicked too rapidly e.g. if you accidentally clicked a button several times in quick succession, something strange happens - the application slowly moves forward, frame by frame, of it's own accord and is unusable. It has to be restarted. Does anyone know about this glitch Or, if not, could there be a way around the problem - e.g. is there some way to limit the click rate
Flash Know if user is clicking a line?   (102 Views)
I have a chart created dynamically with values coming from an XML file. I use something like: Code: var line_commands:Vector. = new Vector.(); // use the Vector array push() method to add moveTo() and lineTo() values line_commands.push(1, 2, 2); var line_coord:Vector. = new Vector.(); // x,y coordinates in pairs line_coord.push(5,5, 10,0, 15,12); graphics.drawPath(line_commands, line_coord); I need to know when the user clicks on the line (or hovers over the line) and the x,y coordinates. I suppose that using a function like .hitTest (supposing it'd be helpful, I've never used it myself) would help, but I don't think I can use it with a simple line. Any suggestions on how to achieve this Please be as specific as possible, I'm new to AS3 I'll appreciate your help.
clicking quickly and repeatedly on a button   (115 Views)
I want to set a button up so it is activated and it's function runs completely before it can be activated again. I have tried a ton of things, but I can't get it to survive multiple clicks. The swf does everything great so long as I click slowly but kids are going to use this and they will be clicking like crazy. I need a very basic example of how to set up and event listener and it's associated function such that the FLV player associated with it can change it's source and be ready to play the new source file before the source can be changed again by the next button click or better still only one button click is allowed until everything is ready to play and any other button clicks are disreguarded.
How can i waving this flag without clicking on it?   (92 Views)
, this project is created in FlashDevelop. It is a waving a flag by clicking on it,but, how I can make the flag flown directly when i execute the swf. Here's the code: Code: package { import com.innerdrivestudios.visualeffect.WrappingBitmapData; import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.BitmapDataChannel; import flash.display.BlendMode; import flash.display.DisplayObject; import flash.display.GradientType; import flash.display.GraphicsBitmapFill; import flash.display.Sprite; import flash.events.Event; import flash.events.KeyboardEvent; import flash.events.MouseEvent; import flash.filters.DisplacementMapFilter; import flash.geom.ColorTransform; import flash.geom.Matrix; import flash.geom.Point; import flash.geom.Rectangle; /** * Same as previous example, but now with a good looking displacement map. We use the built in perlinNoise * function for that. Since this is a costly operation we generate a tiny noise map and scale it. * * @author JC Wichman */ public class Example5 extends Sprite { //what's a flag without a sky;)! [Embed(source = '../sky.jpg')] private var Sky:Class; /** A boring checker flag image */ [Embed(source = '../flag_image.jpg')] private var CheckerFlag:Class; /** A cool iron maiden flag image */ [Embed(source = '../flag_image2.jpg')] private var IronMaidenFlag:Class; //the underlying bitmapdata source for the dispMapBitmap, used to feed to the actual //displacement map applied to the flag/lightmap composite private var _dispMapBitmapData:BitmapData = null; //container for onscreen dispMapBitmapData, with effect to provide lighting effect private var _dispMapBitmap:Bitmap = null; //displays our source flag image with a border around it as buffer for the displacement offset private var _flagBitmap:Bitmap = null; //the underlying pixel data for the flagimage private var _flagBitmapData:BitmapData = null; //the bounds of the embedded pixeldata within the flagBitmapData //the real flag pixels are centered in the flagBitmap, so that the pixels don't fall of the screen private var _flagBounds:Rectangle = null; //contains composite of flag image and displacementmap-used-as-lightmap private var _mainNode:Sprite = null; //the perlin noise offset private var _offset:Number = 0; //a small bitmap used to generate the perlinnoise is, after which we scale it //this is cheaper than generating a large perlinnoise map private var _small:BitmapData = null; private var _scaleMatrix:Matrix = null; //we want the right part of the flag to be displaced more than the left, so we //mix in a gradient from black to white, left to right private var _gradient:BitmapData = null; //track whether we have activated the flag yet private var _active:Boolean = false; //contains the lines from pole to flag private var _lines:Sprite = null; //switches the flag private var _switch:Boolean = false; private var _skyBitmap:Bitmap = null; public function Example5():void { _skyBitmap = new Sky(); _skyBitmap.bitmapData = new WrappingBitmapData (_skyBitmap.bitmapData); _skyBitmap.y = -50; addChild (_skyBitmap); //create container for displacement data and _dispMapBitmapData = new BitmapData (350, 250); _dispMapBitmap = new Bitmap (_dispMapBitmapData); //create bitmap to hold result _flagBitmapData = new BitmapData (_dispMapBitmapData.width, _dispMapBitmapData.height, true, 0x0); _flagBitmap = new Bitmap (_flagBitmapData); //paint in first flag _setupBuffer(); //create small perlinnoise holder and scale matrix, which is needed later _small = new BitmapData (_dispMapBitmapData.width / 10, _dispMapBitmapData.height / 10, false, 0x0); _scaleMatrix = new Matrix (); _scaleMatrix.scale (10, 10); //create the gradient which we combine with the perlinnoise map to create a kind of inverted falloff //for the displacement map _gradient = new BitmapData (_dispMapBitmapData.width, _dispMapBitmapData.height, false, 0x0); var lGradient:Sprite = new Sprite(); var lMatrix:Matrix = new Matrix(); lMatrix.createGradientBox (_dispMapBitmapData.width, _dispMapBitmapData.height, 0, 50, 50); lGradient.graphics.clear(); lGradient.graphics.beginGradientFill (GradientType.LINEAR, [0x202020,0xffff30], [1,1],[0, 255], lMatrix, "pad"); lGradient.graphics.drawRect (0, 0, _dispMapBitmapData.width, _dispMapBitmapData.height); lGradient.graphics.endFill(); _gradient.draw (lGradient); //setup the composite of the flag and displacement map _mainNode = new Sprite (); _mainNode.addChild (_flagBitmap); _mainNode.addChild (_dispMapBitmap); //move map to align with flag image painted in flagbitmap //the +2 is not necessary, it happens to create a funny egde _dispMapBitmap.x = _flagBounds.x+1; _dispMapBitmap.y = _flagBounds.y+1; _dispMapBitmap.scrollRect = _flagBounds; //you can play a lot with the blendmodes and color transforms to imitate different lighting effect _dispMapBitmap.blendMode = BlendMode.MULTIPLY; _dispMapBitmap.transform.colorTransform = new ColorTransform (5, 5, 5, 1, 140, 140, 140, 0); addChild (_mainNode); //setup the disp map on the main node _mainNode.filters = [ new DisplacementMapFilter (_dispMapBitmap.bitmapData, new Point (0,0), BitmapDataChannel.RED, BitmapDataChannel.GREEN, 45, 45, "ignore", 0, 0) ]; //paint an ugly flagpole var lFlagpole:Sprite = new Sprite (); lFlagpole.graphics.clear(); lMatrix.createGradientBox (20, 0, 0, 10, 20); lFlagpole.graphics.beginGradientFill (GradientType.LINEAR, [0x505050, 0xd0d0d0, 0x606060, 0x808080, 0x303030], [1,1,1,1,1],[0, 128,180,200,255], lMatrix, "pad"); lFlagpole.graphics.drawRect (10, 30, 20, 400); lFlagpole.graphics.endFill(); addChild (lFlagpole); _lines = new Sprite(); addChild (_lines); addEventListener (Event.ENTER_FRAME, _onEnterFrame); addEventListener (MouseEvent.CLICK, _onMouseClick); _render(); } private function _onMouseClick(e:MouseEvent):void { if (!_active) { _active = true; } else { //_setupBuffer(); } } private function _onEnterFrame (pEvent:Event):void { if (!_active) return; _render(); } /** * Repaints buffer with a different image. */ private function _setupBuffer():void { var lData:BitmapData = null; if (_switch) { lData = Bitmap(new CheckerFlag()).bitmapData; } else { lData = Bitmap(new IronMaidenFlag()).bitmapData; } _flagBounds = new Rectangle ( (_flagBitmapData.width - lData.width) / 2, (_flagBitmapData.height - lData.height) / 2, lData.width, lData.height ); //copy it directly for a straight flag _flagBitmapData.copyPixels (lData, lData.rect, new Point (_flagBounds.x, _flagBounds.y)); _switch = !_switch; } private function _render():void { //generate the noise _small.perlinNoise (10, 10, 1, 1, false, false, 7, true, [new Point(-_offset, _offset/5)]); _offset += 1; //redraw the noise scaled up (smooth it or it will look awful) _dispMapBitmapData.lock(); _dispMapBitmapData.draw (_small, _scaleMatrix, null, null, null, true); _dispMapBitmapData.draw (_gradient, null, null, "multiply"); _dispMapBitmapData.unlock(); _mainNode.x = 5*Math.sin (_offset/7); _mainNode.y = 5*Math.sin (_offset / 5); _lines.graphics.clear(); _lines.graphics.lineStyle (2, 0, 0.5); _lines.graphics.moveTo (30, 40); _lines.graphics.curveTo (_mainNode.x+41, _mainNode.y+49, _mainNode.x+50, _mainNode.y+50); _lines.graphics.moveTo (30, 260); _lines.graphics.curveTo (_mainNode.x + 51, _mainNode.y + 246, _mainNode.x + 50, _mainNode.y + 245); _skyBitmap.bitmapData.scroll ( -1, 0); } } } I think that i have to modify this: addEventListener (Event.ENTER_FRAME, _onEnterFrame); addEventListener (MouseEvent.CLICK, _onMouseClick); _render(); } private function _onMouseClick(e:MouseEvent):void { if (!_active) { _active = true; } else { //_setupBuffer(); } } private function _onEnterFrame (pEvent:Event):void { if (!_active) return; _render(); } I want to waving the flag without clicking on it, what is the correct as3 code to do it, please
Flash Random shape change when clicking in as3?   (127 Views)
I want to do a flash application follow the imape file I attached here, does anyone know how to change a shape to random shape when clicking using as3
activate embeded flash without clicking in html page   (100 Views)
! I've made a little game, in which the first action the player has to do is to press the space bar. I've embeded this small game in an html page. The problem is that the player need to first click in the area of the embeded flash before the space bar action will be affective. This game is not intended for web friendly poeple only, so I'm afraid that some of the users will not understand they have to activate the area of the embeded flash before playing. Is there any way to activate it, with javascript for example, so the space bar pressing will be immediately effective Or is it to be done in actionscript Thank you for helping me on this question!
Glitch with too much clicking? In Flash application?   (107 Views)
I made an interactive flash application a few years ago that works as a sort of mini-operating system, and everything within it normally works fine - all the actionscript code is correct and relatively simple. However, sometimes when something is clicked too rapidly e.g. if you accidentally clicked a button several times in quick succession, something strange happens - the application slowly moves forward, frame by frame, of it's own accord and is unusable. It has to be restarted. Does anyone know about this glitch Or, if not, could there be a way around the problem - e.g. is there some way to limit the click rate
unload swf by clicking a button   (110 Views)
, I created a flash site and on the gallery page I load a gallery .swf and I want to be able to click on the "about" and "contact" buttons and have it go to there page and unload the gallery swf. This is the code I have on the gallery frame import flash.net.URLRequest; import flash.display.Loader; import flash.events.Event; import flash.events.ProgressEvent; function startLoad() { var mLoader:Loader = new Loader(); var mRequest:URLRequest = new URLRequest ("gallery.swf"); mLoader.contentLoaderInfo.addEventListener(Event.C OMPLETE, onCompleteHandler); mLoader.contentLoaderInfo.addEventListener(Progres sEvent.PROGRESS, onProgressHandler); mLoader.load(mRequest); } function onCompleteHandler(loadEvent:Event) { addChild(loadEvent.currentTarget.content); } function onProgressHandler(mProgress:ProgressEvent) { var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal; trace(percent); } startLoad(); This is the code on for the buttons var mLoader :Loader = new Loader(); about_btn.addEventListener(MouseEvent.MOUSE_DOWN, about); function about (e:MouseEvent):void { gotoAndStop ("about");} contact_btn.addEventListener(MouseEvent.MOUSE_DOWN , contact); function contact (e:MouseEvent):void { if(mLoader.content != null)removeChild(mLoader); gotoAndStop ("contact");} gallery_btn.addEventListener(MouseEvent.MOUSE_DOWN , gallery); function gallery (e:MouseEvent):void { if(mLoader.content != null)removeChild(mLoader); gotoAndStop ("gallery");}
roll over flash movie in html without clicking it first   (114 Views)
hi.... i need to be able to roll over flash movies that are embedded in html without clicking them first. basically i have made a scrolling image holder with images that when pressed open a new web page. so i need to be able to roll over and drag the scroll bar. any thoughts would be great..... maybe some extra code on the html page i have the css in an external style sheet if that makes any difference. cheers.......
stage click listener gets called when clicking MC   (122 Views)
I'm sure this has been answered but I don't even know what to search for... I have a drop-down menu that stays open when I click it, until I click it again. I want it to close when I click away from it. So I created an event listener of type MouseEvent.CLICK and apply it to the stage. The obvious problem is, though, that when I click the drop-down menu to make it open, I'm also clicking the stage, which prevents it from opening. I think there's probably a simple solution to this but I'm stuck. I called stopPropagation() on the drop-down menu and that seems like it should help but it doesn't. Thank you!
Textfield gets in the way of clicking event   (101 Views)
Hi I have a mc that holds a rectangle and a dynamic textfield on it. Then I set some mouse events to drag the rectangle, but the textfield gets in the way and returns the error: property startDrag not found on flash.text.TextField and there is no default value. Help
Stop multiple clicking   (103 Views)
Hi all, I'm writing a function to some buttons that has a TweenLite function to it. I only want it to tween once when it's clicked. So to stop people clicking them multiple times, I've put a MouseEvent.CLICK, and a MouseEvent.DOUBLE_Click EventListeners to the buttons. "scrollLeft" and "scrollRight" will do its usual thing and "doNothing" is just an empty function. Code: arrowLeft.addEventListener(MouseEvent.CLICK,scrollLeft); arrowRight.addEventListener(MouseEvent.CLICK,scrollRight); arrowLeft.addEventListener(MouseEvent.DOUBLE_CLICK,doNothing); arrowRight.addEventListener(MouseEvent.DOUBLE_CLICK,doNothing); But the scrolling still works if I click super quick. Can someone tell me what's the best way to stop this I'm pondering putting doing a setInterval on the scrolling functions to disable the button for 1second or so.
Load first content without clicking the button   (116 Views)
I successfully create XML menu and adding MouseEvent in each item and associate it with its content. My problem is that, how to load the first content in the stage without having to click the button Code: public function xmlLoaded(e:Event):void { if ((e.target as URLLoader) != null ) { //Insert the loaded data to our XML variable _btnLabels = new XML(e.target.data); _btnLabels.ignoreWhitespace = true; init(); } } private function init():void { var i:int = 0; for each (var section_name:XML in _btnLabels.sections.section){ var b:MovieClip = new butt(); //trace(i); b.id = i; b.content =_btnLabels.sections.section.section_content[i]; addChild(b); _allButt.push(); b.buttonMode = true; b.mouseChildren = false; b.addEventListener(MouseEvent.MOUSE_OVER, RollOver); b.addEventListener(MouseEvent.MOUSE_OUT,RollOut); b.addEventListener(MouseEvent.CLICK,onClick); i++; } } private function onClick (e:MouseEvent):void { //enable disable button var btn = e.currentTarget; btn.mouseEnabled = false; btn.buttonMode = false; btn.alpha = 0.70; lastClicked.mouseEnabled = true; lastClicked.buttonMode = true; lastClicked.alpha = 1; lastClicked = btn; dispatchEvent(e); } public function set content(loadedContent:String):void { for (var btn in _btns) { _btns[btn].content = loadedContent; } }