[Flashcoders] remove a Dynamic dropDown menu problem
Hi flash coders, I have created a menu dynamically and then when clicking on any of the menu elements, I create a dynamic dropDown menu. All is well and working but I am having problems deleting the dropDown menu and all it elements when rolling over or clicking on a different menu element . After many trials I have managed some code but it only removes the last element of the dropDown menu (and its relative button). My questions are: 1) what is the best way to create functions to control the dropDown menus (there will be a few created when rolling over the elements of the main menu) 2) What event can I use to remove the dropDown when the mouse rolls out or clicks on a different main menu item. 3) How do I make sure that the 'for loop' will actually remove all of the elements of the dropMenus and not just the last one (or first one for that matter) Some help would be much appreciated. Following is the code I am using (I know that I should write fucntions to make the code clearer and more modular but I would need to spend time in doing it correctly and, given also my inexperience, I rather leave it till last when I can revisit the code, if i'll have any spare time :) :)) : stop(); // // Init properties and variables _ var myTxt:Array = new Array("branding", "news", "about us", "print", "marks", "contact"); var dropMenuArray = new Array("Sea Bounty", "Fire Brigade", "CommonWealth Bank"); var subMenuArray:Array = new Array(); var dropBtnArray:Array = new Array(); var dropTextArray:Array = new Array(); var myX = 680; var ySpacing:Number = 290; var spaceMe:Number = 20; var myName:String = ""; var btn:Button; var subBtn:Button; var subMenuEnable:Boolean = false; var isDone:Boolean = false; // //create the textFields for the subMenuItems___ // for (i=0; i _root.createTextField("mytext"+i, this.getNextHighestDepth(), myX, 0, 100, 30); myId = _root["mytext"+[i]]; myId._y = ySpacing; ySpacing += 20; // //trace(myTxt[i]); myId.text = myTxt[i]; // // //Format the text of the subMenuItems_ // myId.border = false; myformat = new TextFormat(); myformat.font = "Verdana"; myformat.size = 14; myformat.bold = false; myformat.color = 0x55; myformat.align = "right"; // myId.selectable = false; myId.setTextFormat(myformat); // //__create an Array with the submenuItems to be used in the buttons control function__ // subMenuArray.push(myId.text); //trace(subMenuArray[i]); // //attach a button (on top of) to each textFields__ // btn = this.attachMovie("butt_btn", myTxt[i], this.getNextHighestDepth()); btn._alpha = 0; btn._x = myX; btn._y = myId._y; // //***ATTACH BEHAVIOUR TO THE BUTTONS*** // //__RollOver_ // btn.onRollOver = function() { myName = this._name; //trace("this will load the "+myName +" subMenu") for (e=0; e //_create an array to use later to control the buttons_ // //myBtnArray.push(btn); //trace("The y for "+myBtnArray[i]+" is: "+btn._y+" and its x is: "+btn._x); // } // //*CREATE THE TEXTFIELDS AND THE INVISIBLE BUTTONS FOR THE SUB MENU* // function dropMenu(thisOne) { if (!isDone && subMenuEnable == true) { for (i=0; i _root.createTextField("mySubText"+i, this.getNextHighestDepth(), thisOne._x-100, 0, 130, 25); newId = _root["mySubText"+[i]]; newId._y = thisOne._y+spaceMe; spaceMe += 25; // newId.text = dropMenuArray[i]; // // //Format the text of the dropMenuItems_ // format = new TextFormat(); //format.border = true; //format.backgroundColor = 0xE6CCE6; format.font = "Verdana"; format.size = 12; format.bold = false; format.color = 0xF0A65B; format.align = "right"; format.autoSize = "center"; // newId.selectable = false; newId.setTextFormat(format); dropTextArray.push(newId); //trace(dropTextArray) // //attach a button (on top of) to each textFields__ // subBtn = this.attachMovie("butt_btn", dropMenuArray[i], this.getNextHighestDepth()); subBtn._xscale = newId._width; //subBtn._yscale = newId._height; //subBtn.blendMode = "darken"; subBtn._alpha = 30; subBtn._x = newId._x; subBtn._y = newId._y; dropBtnArray.push(subBtn); //trace(dropBtnArray); trace(isDone) //this traces 'false' for the first iteration but b
RE: [Flashcoders] bouncing ball
Maybe something in here could help... Collision detection & bouncing part 3: bouncing balls http://www.johanvanmol.org/content/view/45/37/ Detecting Collisions Between Any Point of Two Movieclips http://www.flash-creations.com/notes/astb_bounceCollide.php Ball vs arc http://www.tonypa.pri.ee/vectors/tut12.html Bounding circle computation http://lab.polygonal.de/2007/02/17/bounding-circle-computation/ Create a flash draw game like Line Rider or others - A different approach - Part 2 http://www.emanueleferonato.com/2007/04/21/create-a-flash-draw-game-like-lin e-rider-or-others-a-different-approach-part-2/ Source Code: Shape-based Hit Detection in 8 http://www.gskinner.com/blog/archives/2005/10/source_code_sha.html BitmapData.hitTest http://algorithmist.wordpress.com/2007/05/06/bitmapdatahittest/ Camera Interaction with Flash http://www.gskinner.com/blog/archives/2006/11/camera_interact.html Collision detection with Recursive Dimensional Clustering http://lab.polygonal.de/articles/recursive-dimensional-clustering/ 2-Dimensional Collisions http://www.geocities.com/vobarian/2dcollisions/ _ Jesse Graupmann www.jessegraupmann.com www.justgooddesign.com/blog/ _ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Waseem Shahzad Sent: Saturday, May 19, 2007 6:11 AM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] bouncing ball Hello everybody; I want to know that is it possible to bounce a ball in an irregular shaped object's virtual boundaries. Please help. Thanx to all; chand ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] AS3 blows_up on gotoAndPlay
Why do you need those gotoAndPlay's? If those are the only three frames in the clip, it will automatically cycle through like that unless you have a stop() command. On 5/19/07, dave matthews <[EMAIL PROTECTED]> wrote: What is going on here please? Create a three frame AS3/Flash9 clip. Place a textbox/number on each frame: 1,2,3. ActionScript panel, frame one = gotoAndPlay(2); ActionScript panel, frame two= gotoAndPlay(3); ActionScript panel, frame three = gotoAndPlay(1); Test movie. Stalls the compiler bad - Flash IDE must be closed. Why does this trip up the compiler? thanks, Dave_Matthews _ More photos, more messages, more storage—get 2GB with Windows Live Hotmail. http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_2G_0507 ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] AS3 blows_up on gotoAndPlay
What is going on here please? Create a three frame AS3/Flash9 clip. Place a textbox/number on each frame: 1,2,3. ActionScript panel, frame one = gotoAndPlay(2); ActionScript panel, frame two= gotoAndPlay(3); ActionScript panel, frame three = gotoAndPlay(1); Test movie. Stalls the compiler bad - Flash IDE must be closed. Why does this trip up the compiler? thanks, Dave_Matthews _ More photos, more messages, more storageget 2GB with Windows Live Hotmail. http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_2G_0507 ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] how to accesscustom TitleBackground(skinTitleBackground) of Window
Well, it sounds like you're trying to use a skin for something beyond it's purpose. Anyway, the background skin is dynamically attached in the createChildren method of the Window class and is named "back_mc". So if you want to access it, this should work: myWindow.back_mc regards, Muzak - Original Message - From: "Andrew Sinning" <[EMAIL PROTECTED]> To: Sent: Saturday, May 19, 2007 2:04 PM Subject: Re: [Flashcoders] how to accesscustom TitleBackground(skinTitleBackground) of Window > Let me ask the question another way: how do I access movieClips and/or > TextFields within my custom TitleBackground _in_general_, > regardless of what I call them. Suppose there's a movieClip called > "someClip" inside my TitleBackground and I want to changes > it's _visible prop. How do I get a handle to this clip? Neither > "window.TitleBackground.someClip" nor > "window.skinTitleBackground.someClip" seem to be "public". It's as if I need > to specify that they are public in an interface > somewhere, but I have no idea how? > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] bouncing ball
Hello everybody; I want to know that is it possible to bounce a ball in an irregular shaped object's virtual boundaries. Please help. Thanx to all; chand ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] how to access custom TitleBackground(skinTitleBackground) of Window
Let me ask the question another way: how do I access movieClips and/or TextFields within my custom TitleBackground _in_general_, regardless of what I call them. Suppose there's a movieClip called "someClip" inside my TitleBackground and I want to changes it's _visible prop. How do I get a handle to this clip? Neither "window.TitleBackground.someClip" nor "window.skinTitleBackground.someClip" seem to be "public". It's as if I need to specify that they are public in an interface somewhere, but I have no idea how? Muzak wrote: If for some reason you want to put your own title textfield in the header, you'll need to have a movieclip (instance name 'title_mc') that contains a textfield (instance name 'text') inside your custom TitleBackground. Woops.. that's incorrect.. You need to have a textfield named "title_mc" ;-) But again, you should probably leave it up to the Window to create the title for you. regards, Muzak - Original Message - From: "Muzak" <[EMAIL PROTECTED]> To: Sent: Friday, May 18, 2007 10:16 PM Subject: Re: [Flashcoders] how to access custom TitleBackground(skinTitleBackground) of Window The Window component class takes care of creating a title for you. You don't need to do anything, just set the .title property on the Window instance. If for some reason you want to put your own title textfield in the header, you'll need to have a movieclip (instance name 'title_mc') that contains a textfield (instance name 'text') inside your custom TitleBackground. The textfield might get affected by the stretching of the TitleBackground though, so not sure how well this will work out. regards, Muzak - Original Message - From: "Andrew Sinning" <[EMAIL PROTECTED]> To: "Flash Coders" Sent: Friday, May 18, 2007 9:39 PM Subject: [Flashcoders] how to access custom TitleBackground (skinTitleBackground) of Window I've created a TitleBackground movieClip by following the instructions in the MX04 online help "To set the title of an Window component to a custom movie clip symbol" (below). Now I'd like to make a call to a function inside of that clip or access properties within that clip directly. The window has a property skinTitleBackground the value of which is an object of type "TitleBackground", but TitleBackground doesn't have any public properties. Inside my TitleBackground movieClip there is a TextField called "titleText" that I would like to be able to set the text of. So far the only way I've been able to change it is by having a loop within the movieClip check on the value of an external variable. There should be another way, right? ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Extract and use numbers from string
Hi, Im not sure what you mean, the x for the clips is simply: current_location._x getting the reference is eg (if this is the movieclips parent): this["location_"+row+"_"+column] parsing the x and y from the name can be done (quick and dirty) with: var movieclipNameParts:Array = (""+clipreference._name).split("_"); var x:Number = Number ( movieclipNameParts[ 1 ] ); var y:Number = Number ( movieclipNameParts[ 2 ] ); greetz JC On 5/19/07, Johnny Zen <[EMAIL PROTECTED]> wrote: Can anyone help me with this one. i have movie clips named location_0_0_mc location_0_1_mc location_1_0_mc location_1_1_mc set up in a grid style, so the number represent x and y or columns and rows // location_x_y_mc I need to a formula to work out if for example var current_location = location_0_1_mc var possible_location = location_1_1_mc if (current_location X >= possible_location X) { //do this } if (current_location Y >= possible_location Y) { //do this } etc etc Can anyone help? Thanks ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] Local connection no good in tabbed browsing
I've noticed that when using Localconnection in FF (not tested in IE) with tabbed browsing, the communication between two SWFs can get lost becuse the same SWF can be running at the same time. Has anyone experienced this and have a solution/workaround? ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] Extract and use numbers from string
Can anyone help me with this one. i have movie clips named location_0_0_mc location_0_1_mc location_1_0_mc location_1_1_mc set up in a grid style, so the number represent x and y or columns and rows // location_x_y_mc I need to a formula to work out if for example var current_location = location_0_1_mc var possible_location = location_1_1_mc if (current_location X >= possible_location X) { //do this } if (current_location Y >= possible_location Y) { //do this } etc etc Can anyone help? Thanks ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Easy game in flash
hi Pedro, Search on the web for some tutorials on game development with flash. Or, you can get a book on the subject, which will have loads of examples for you to try, program, learn and modify. Here is one possible title, but there are many others: http://www.friendsofed.com/book.html?isbn=1590592360 Good luck Pedro! And enjoy! It's fun. :) Sebastian. Pedro Kostelec wrote: Actually, I'm not looking to make a so complicated game like this one. I just want to learn some good basics in doing games. So, if anyone know any tutorial for a similar or easier game it'll be ok, too. I'm not looking to work with alorithms, becouse I don't know very well what is that (I'm just 15 years old).Thanks for worring Pedro 2007/5/18, Joshua Sera <[EMAIL PROTECTED]>: That game's actually not as simple as you might think, unless you already have the math background (verlet integration/swept circle hit tests/camera or viewport systems) to replicate what this game does. If you don't already know the math/algorithms for what I'm talking about, you'll want to google them. The author might be using Flash's hitTest() method for collision detection, but I kind of doubt it. --- Pedro Kostelec <[EMAIL PROTECTED]> wrote: > hi flash coders > First of all scuse me for my English > I'm quite new in flash and I want to create a game > like this one in this > website: > http://www.teagames.com/games/tgmotocross3/play.php > of course not so complicated, bcouse it would be my > 1st flash file > I was trying to do a motorbike riding on some ground > with the hitTest() > function, but It just doesn't work becouse the > ground is a curved line and > the bike just get stright it when the ground grown > up. > If someone knows a good tutorial for such things, > please help me. > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the > archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com