Remove Child? AS3 - actionscript-3

So I'm incredibly new to AS3, and barely know my way around.
I built a simple colouring book game, essentially changing some of the graphics of a tutorial, and replacing numbers and sizes to fit what I wanted to achieve. I then built a menu screen in a seperate scene and linked the two with code snippets and buttons to go back and forth.
The colour pickers are generated when the game is ran, however an issue I seem to be facing is that when I go back to my main menu, they are still there.
Can someone point me in the right direction as to how I can fix this? I'm sure it's a rather simple fix. I can provide the code from the tutorial if needed

I think you're right you need removechild this color to remove one color from stage... Maybe you need removechildren to remove all color, whin are on stage... Try this two way

Related

How Do I Make 3D Objects in CSS

I've been trying to create a rectangular prism as indicated from here:
(example) http://desandro.github.io/3dtransforms/examples/box-02-show-sides.html
There's also a tutorial page.
but these are my results,
http://codepen.io/anon/pen/qFdiu
I don't know what is wrong here.. sometimes when I check a preview in chrome, it will animate, but not in the right place, the prism won't be in its container and it won't transform on the correct origin, i.e. like flipping a block on the floor it will move over, instead of being in its original place but on a different face. I've even tried copying everything from the tutorial but can't find out the fault. I am pretty new to webdesign. Would appreciate any help :)

Box2D Lights Wall Shadowing

Alright, so I've been pondering over this for quite awhile now; looking through documentation, examples, previously made games, ect...
Basically (for those familiar with Box2d Lights), I'm trying to create bodies on top of my walls (so there's shadow casting, and so the light will stop instead of going through the wall). I have no problem creating, positioning, and updating the bodies, but the only real problem which I can't figure out is a way to make the filled body to be invisible or transparent so it shows my tileset (or wall) while still giving a shadow effect if light was casted onto it.
Perhaps I'm thinking or going about this the wrong way. Feel free to correct me.
Here's an image to display an example of a body I created on top of my wall. The shadows are handled properly, but I cannot see my wall.
Any help is greatly appreciated. Thanks.
You have two options here:
Set the shadow-dropping bodies behind the wall and use only transparent bodies for collision detection using BitMasks
Or render your wall sprites on top of box2dLights

Non-scaling thumb skin Flash UIScrollBar AS3 alternatives

There's probably a million posts about scrolling in AS3, but the problem I'm having is quite different. I have no problem making scrollbars work (have done loads of times), but I'm having a problem with custom skins. I'm basically trying to make the bar in this concept:
concept http://img842.imageshack.us/img842/5081/screenshot20130507at140.png
The key part is the thumb. When customising the skins in Flash, it scales the thumb bar (which hasn't been a problem in my previous projects, but in this one I want to have a non-scaled graphic like the one in the concept.
I've done a few searches and apparently this isn't easily achieved (something about extending the component class that I didn't really understand), but I find the UIScrollBar very easy to use. So my questions are:
Is there anyway to get UIScrollBar to do what I want?
Failing that, is there a third party equivlent of UIScrollBar that'll do what I want?
Failing those, what is the most pain-free way of making a custom scrollbar in AS3? (I realise there's a lot of tutorials for this out there, but there's too many, so if someone could point me towards a tutorial that doesn't require cause pain I'd appreciate it)
Thanks! (:

Custom cell in list in Flash AS3

I am no expert in Flash, and I need some quick help here, without needing to learn everything from scratch.
Short story, I have to make a list where each cell contains an image, two labels, and a button.
List/Cell example:
img - label - label - button
img - label - label - button
As a Java-programmer, I have tried to quicly learn the syntax and visualness of Flash and AS3, but with no luck so far.
I have fairly understood the basics of movie clips etc.
I saw a tutorial on how to add a list, and add some text to it. So I dragged in a list, and in the code went list.addItem({label:"hello"}); , and that worked ofc. So i thought if I double-clicked the MC of the list, i would get to tweak some things. In there I have been wandering around different halls of cell-renderers etc.
I have now come to the point that I entered the CellRenderer_skinUp or something, and customized it to my liking. When this was done, I expected i could use list.addItem(); and get an empty "version" of my cell, with the img, labels and the button. But AS3 expects an input in addItem. From my object-oriented view, I am thinking that i have to create an object of the cell i have made, but i have no luck reaching it.. I tried to go
var test:CellRenderer = list.listItem;
list.addItem(test);
..But with no luck.
This is just for funsies, but I really want to make this work, however not so much that I am willing to read up on ALOT of Flash and AS3. I felt that I was closing in on the prize, but the compiler expected a semicolon after the variable (list.addItem({test:something});).
Note: If possible, I do NOT want this:
list.addItem({image:"src",label:"text",label"text",button:"text"});
Well.. It actually is what I want, but I would really like to custom-draw everything.
Does anyone get what I am trying to do, and has any answers for me? Am I approaching this the wrong way? I have searched the interwebs for custom list-cells, but with no luck.
Please, any guiding here is appreciated!
Sti
You could use a Datagrid as well, with each column pointing to the appropriate part of the data source (possibly even the same field, depending on what you're doing). You can then just use the ImageCell as the renderer for the second and third colums.
I think you're just not understanding that Adobe, in the own woolly-headed little way, is separating the Model from the View on your behalf. You hand the Model to the View and then get out of the way. The extent of what you can/should change is just telling it what renderer to pop your data into.
In fact, the fl.controls don't give you much control at all about how they work--I wouldn't go down the road of trying to create a custom itemRenderer with any signifcant functionality for them if you don't fully understand how the Display List works and if you're not comfortable digging around in the debugger and ferreting out all kinds of undocumented information.
For more details (to the extent anyone knows anything about how these work), see
http://www.adobe.com/devnet/flash/quickstart/datagrid_pt1.html
http://www.adobe.com/devnet/flash/quickstart/datagrid_pt2.htmlhttp://www.adobe.com/devnet/flash/quickstart/datagrid_pt3.html
http://www.adobe.com/devnet/flash/quickstart/tilelist_component_as3.html
Do you have the option to use the Flex Framework instead of pure Flash? It makes this kind of extension much more satisfying. It's aimed more at application developers, whereas Adobe sees Flash users more as designers.

Scrollbar with Sprite and Rectangle won't move text, just the Rectangle it's painted on

Warning: school assignment.
For those of you still with me, I am tasked with making some scrollable content in Flash. Load in a TextFile using LoadURL(), then display it. To get the text, we've written our own class TextFieldExtended, which is basically just there to give the textfile location to the constructor and then have the class do the various steps of getting it and loading it for you.
So I needed to get a Scrollbar, which I got here: http://kirupa.com/forum/showthread.php?t=245468
(all files in a zip linked at the end of this text)
The thing is, it works with Sprites.
After trying to get it to accept TextFieldExtended, I bumped into a block, since the scrollbar relied heavily on a Sprite property that TextFieldExtended didn't have or could have.
So I tried adding the TextFieldExtended instance to a Sprite instance using addchild.
A problem occurs here that I do not know how to handle. It seems that a Rectangle is drawn and the Text is drawn on that. I say this because the scrollbar moves the Rectangle up and down a bit, but the text doesn't scroll, just the Rectangle it is positioned in and the text then moves along with it.
My question: can this be fixed, or is does this implementation of scrollbars need a lot of adaptations before this is possible?
If so, any scrollbars you can recommend, because it's too extended for me at this point.
All files: http://www.mediafire.com/?q2ium22gmox
This was made in Flash CS4 using ActionScript3. The Example class is the final implementation
Sounds like an odd problem; I was reading up to the point where you say you put your TextField in a Sprite thinking "he just needs to put that TextField in a Sprite", so I'm not quite sure how to fix the specific problem you've got. I'd guess it's the Scrollbar you're using. So here's another one that's fairly straightforward to use:
http://www.warmforestflash.com/blog/2009/04/free-as3-scrollbar-fullscreen-and-resizable/
Give that a whirl. Scrollbars can be fiddly in my experience, but it's just a matter of finding an implementation that suits you. Hope it helps.