Actionscript 3.0 :: Movieclips To Turn On Or Off Won't Work?
Jul 17, 2009
I would like to use variables and arrays for the following scenario regarding a project I'm doing, but I'm not sure how to go about it. I've attached the fla file too as it's more self-explanatory.
Basically when you click on the little squares/pixels, they expand. If you click one of the movieclip-buttons, it pops up all the relevant pixels to make a desired pre-set shape. However if you start clicking the pixels after that and click on another button, the roles of the clicked pixels reverse and the negative happens. What I thought about doing was creating a variable on the pixel_mc movieclip (that way all instances would follow suit). When it has been clicked a variable is set to 1, from that I can decided whether or not to turn pixels that are on, to off, or off, to on. This would be decided with an IF statement, all which I can not do.
I would like to use functions and arrays to control most of this as there are 234 instances of one movieclip to control. Again I'm so not sure how to go about this.
View 4 Replies
Similar Posts:
Sep 6, 2009
Basically I am making a Turn Based battle system. Each Frame is an attack. So for the enemy I did this:
(in scene Frame) attack = Math.round (Math.random ()*2)+0;
so it would randomly attack
then I also put in this in an object INSIDE my enemy clip
onClipEvent(enterFrame){
onClipEvent(enterFrame){
if (_root.attack == 1 || _root.attack == 2){
[Code].....
you see what ive tried to do here havent you?
why isnt it working? it plays, the random value thing works(used dynamic text box to check this) so what am i missing? (using AS2)
View 17 Replies
Oct 7, 2011
I'll start off by saying I'm a newbie, just putting that out there. How do you make a turn by turn multiplayer flash game? I don't know if an engine is made in AS3, PHP, Javascript, or whatever,I made my game already, it's just that it isn'tmultiplayer yet. Basically, there are lines, and each player crosses out a number of lines, and the last player to cross out a line is the loser. I want it where one user crosses out some lines, then presses End Turn, then the other does their turn and then presses End Turn to allow the other player to move his cursor. But how can I get both players to see the same frame and only have one player have the ability to move the cursor during a turn? Is there some easily adaptable multiplayer engine for flash for newbies out there
View 2 Replies
May 8, 2010
I'm trying to create a portfolio site and I'm running into some problems. I've built my main site on the timeline and all my buttons work fine the AS is very simple:
function goForward(event:MouseEvent):void {
if(currentFrame == totalFrames) {
gotoAndStop(1);
} else {
nextFrame();
}} next_btn.addEventListener(MouseEvent.CLICK, goForward);
But when I make Movie clips of a scenes with buttons in them (children?) to try and simplify the site, AS doesn't seem to recognize the instance name for the button in the Movie Clip. I get an error message:
1120: Access of undefined property next_btn.
I've put an invisible button over the mc and given it the next_btn instance name and it works although I would like to fix the buttons in the MC properly. Is it better to condense a site into movie clips and single frames or should I just have a long linear timeline that spans many frames?
View 3 Replies
Oct 15, 2010
I am fairly new to AS3 and I have a page on my site that navigates between 3 different movie clips using frame based navigation. I have action script on each of the 3 frames to move between the movie clips and that works just fine but i can't seem to get the tween to work on more than just one movie clip. Here's the code from the first frame:
Code:
Select all//load page
page2.addEventListener(MouseEvent.CLICK, clickSection);
function clickSection(evtObj:MouseEvent) {
//go to the frame clicked on...
gotoAndStop(evtObj.target.name);
//animate between pages
new Tween(page2_mc, "x", Regular.easeOut, 0,260,1, true);
new Tween(page1_mc, "x", Regular.easeOut, 0,260,1, true);
new Tween(page3_mc, "x", Regular.easeOut, 0,260,1, true);
}
Whatever movie clip I put in the first tween will animate but the other two won't.
View 4 Replies
Jul 13, 2009
im practicing on how to do websites in flash cs4 using AS3.0, so im doin a basic dynamic test website, all the codes seem to be fine because i dont get any compilers errors. but one Error that is driving me nuts is the Error #1009 which says.
[Code]....
View 1 Replies
Dec 8, 2009
I have a movieclip that has several buttons inside it. When I use this code:
mc.onRollOver = function()
{
// do stuff
[code].....
View 3 Replies
Mar 16, 2009
I'm surprised that a XML loader works only if it is embed in a MovieClip class and not any external class.
I have my XMLLoader class and the loader didn't work.
I've added "extends MovieClip" and it worked.
View 7 Replies
Jun 15, 2010
Is there a way to make the onMouseDown function also work within the MovieClips area in this code example? It seems like the two functions are conflicting.
attachMovie("nutrition","nutrition",4,{_x:715, _y:370});
nutrition.gotoAndPlay();
nutrition.onPress = function():Void{
[Code].....
View 2 Replies
Nov 22, 2010
I've created three movieclips to select the next level, and these work fine the first time my game runs, but when I come back to them, after the first game is over and we're restarting, the movieclips appear, but the onRollOver,onRollOut and onPress do not work...
[code]...
View 2 Replies
Oct 3, 2002
I have several external SWF (child) movies that are to be loaded upon demand into another SWF container (parent) movie file. Pretty straight forward. Each of the child movies has MCs communicating with other MCs within the same child movie. For instance the timeline of one MC will have a frame action, which targets another MC instance to play(). Again, Pretty straightforward stuff.
These files work beautifully when viewed independently. The problem is when they are loaded into the parent container movie the target MC functionality no longer works. I believe it's because once the child movie is loaded into the parent movie the absolute path of the targeted MC has changed and what was once the '_root' in the child movie is no longer the actual root?
I have tried both methods in the child movie:
//method without using 'with'
_root.ContentWindow.play();
And using the 'with action like so:
//method using 'with
with (_root.ContentWindow) {
play();
}
It would seem that in theory once the Child SWF file is loaded into the Parent SWF file the targeted path would have to have another level in it - cuz now the MC 'ContentWindow' is no longer one level down from the '_root' but two levels?
For example: _root.LoadedChildMovie.ContentWindow.play()
View 3 Replies
Aug 2, 2009
I have several movieclips which name is assigned to the variable MoveN when clicked on. But moving them with MoveN variable doesn't work.
[Code]...
View 4 Replies
Aug 6, 2010
I m trying to make sense of how to load a swf into a parent MovieClip and allow them to communicate.I ve attached two zip files � one which works fine and the other doesn�t. Unfortunately (for me), the one which doesn�t work is closer to my current project.I need to load movieclips into the parent movieclip. The parent movieclip has controls which rely on values parsed from the child movieclip.In the parent movieclips I wait until the loading is complete and so the values should be passed. However, the values aren�t passed unless I use a button (or timer), to pass the values (see the working exampes).The code which doesn�t work is:
Parent movieclip:
ActionScript Code:
stop();
var myLoader:Loader = new Loader();[code].............
View 5 Replies
Mar 27, 2010
I have added a flash sound file to our homepage. How do I add an option for the visitor to turn the sound off? I don't have the .fla file for it.
View 1 Replies
Dec 19, 2009
I have two SWF-Movies. One is exported into eht other as Child.Can I instance the Objects of the two libraries in all places, where ActionScript is possible? (In Keyframes of the MovieClips and in external class definitions.)
View 3 Replies
Sep 9, 2011
Looking for a way to stop all movieclips both are the stage and that are children of the ones on the stage.
I toyed with looping thru stage's children so I can first target clips on the stage. But I am getting error.
for (var i:int = 0; i < this.numChildren; i++) if (this.getChildAt(i) is MovieClip)
{
this.getChildAt(i).stop
}}
View 5 Replies
Sep 10, 2009
I have a very simple project. I just need a flash video that has a sound file and a button to turn on/off.
View 1 Replies
Dec 27, 2009
I have some sounds in a timeline ( i purposely put them on time line rather then through AS3). But is there a way to turn off all sound in the swf, like is there a global sound channel?
View 1 Replies
Jan 13, 2010
Is there any way to turn off the autodocking panels. I just want my panels to be free floating and not stick together. The way they dock and stick together is the worst.
View 2 Replies
Oct 23, 2011
How do you turn off the sound in a game only? I ask because I have two buttons in my settings: turn music on/off and sound on/off. turning music on and off is really easy because it uses a specific sound channel. But How do you turn off the volume the sound only (e.g. music is still playing but not the sound of the game)?
When I mute the sound via SoundMixer.soundtransform you can't hear anything so that's not what I wanted to have. In my game all sounds are thrown into an array. My first idea was that I go through all sounds listed in the array and turn off the volume but that's not working.
Code:
//not working
private var sounds:Array;
private var soundChannels:Array = [];
[code]....
View 1 Replies
Oct 5, 2009
How do you turn a date of bith into months. im doing this:
var dobDate: Date = child.CHILD_DOB; //10th Feb 2008var daysSince:uint = Math.floor((nowDate.time - dobDate.time) / DateTime.DAY); var monthsSince:uint = Math.floor( daysSince / AppConst.DAYS_IN_MONTH);
trace(daysSince) //603 - correct
trace(monthsSince) //20 - incorrect (it should be 19)
note:
AppConst.DAYS_IN_MONTH = 30
DateTime.DAY = 86400000
View 9 Replies
Apr 26, 2010
I have a FLA file with 4 layers 2 of the layers are Text Boxes 2 of them are masks to make the different words "Shine" Is there a way to make the whole file a button so when people click on it, it goes to a different page?
View 6 Replies
Sep 20, 2010
I have 9 fla files. Is there anything I can do to create 1 swf out of 9 separate fla files??? I tried to cut and past the info all onto 1 timeline. Is there more than one way to do this?? I end up with multiple files with the same name in the library and it becomes a bit of a nightmare just trying to use the cut and past method.
View 4 Replies
Nov 25, 2011
I know virtually nothing about Flash so I'm kind of casting about in the dark.
I have the misfortune of being a BT customer, and whilst I have reasonable bandwidth (can view streaming high res video fine) I always have problems listening to radio programmes from the BBC. I think it could be buffering due to traffic shaping, or it could be the Flash applet used to play the content, or something else.
Is it possible to bring up some kind of debugging console, or view some kind of error log to see if there is some diagnostic information that could be useful in finding the problem?
View 1 Replies
Aug 6, 2010
How would I turn something like this...
ActionScript Code:
<feed name="BBC Top Story 1" url="bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml1">
<description>Top Story News</description>
[Code].....
View 3 Replies
Apr 13, 2003
i saw the component thingy on kirupa... but i want to make a car drive in flash with just code.... there is a really good one on (click "drive!" on the menu and you can drive the little car around)... i would really like to know how to do this.
View 3 Replies
May 26, 2003
I know how to turn music on/off but I now want to find out how to do the following. On 50cent.com, you can select from a variety of songs, then play the one you wish. I want to know how to do that, with the buttons changing the songs, then being able to press play, and stop. Could someone tell me how to do this, or redirect me to a tutorial that will teach me. I have flash mx, so you could post a flash mx tutorial if you wish. Another example is shown on West49.com, but I dont need to know how to open the playlist option they have. Just a simple left and right button changing the songs, thena a play and a stop button.
View 1 Replies
Jul 2, 2007
I have 8 buttons. I need to turn one on, and turn the rest of them off. I can't figure out how to do this. do i use loops, booleans?
View 2 Replies
Oct 7, 2009
I'm using the webcam to record some footage, but when I'm done, I can't seem to turn the camera off (the LED stays on) no matter what I try.
Camera.getCamera("")
netStream.close()
View 3 Replies
Jan 13, 2010
How do I turn a value into something i can use without the "-" negative value if there is one.
I have an "imageLoaderHost" movieclip and I need it's x position to be usable wherever its at. for instance:
if imageLoaderHost is at -1258(x position), I need "b1" to go to 1258 (without the "-" as you can see).
View 2 Replies