ActionScript 2.0 :: Complex Toggling Visibility Of Movieclips With Other Clips
Jan 24, 2009
I have a question, but it needs a little backstory and explanation to make sense. I've searched a lot of places for an answer and have only come up short.I'm using Flash 8 and AS2.A few months ago I made a somewhat complex interactive doll.I came up with the idea to have the blouse have these massively poofy sleeves, and then have a jacket be tight fitting. So when I move the movieclip of the jacket over onto the blouse, the sleeves will disappear, kind of like real clothing, where you can bunch up fabric to fit.I did this by cutting the shirt into three separate movieclips and coding them to move together, so when the jacket moved onto the specified coordinates, and the shirt was established on the base, the sleeves movie clip would simply disappear.
Below is part of the action script connected to the jacket.[code]When you move the jacket away, the sleeves are still invisible. And if you have the shirt and jacket on, and you click on the underwear button to view the undergarment movieclips, the sleeves and sides are visible again, simply because that is the coding for the "drawer" buttons. Simply clicking on the jacket or the shirt creates the desired result, but it doesn't look very clean.I've tried using similar script to the above, to make the visibility true, but it's only served to make it visible all the time, even if the drawer buttons make it invisible.[code]
Is there a script I can use so the sleeves disappear once the jacket is on, but immediately after moving the jacket away, the sleeves reappear? And at this point, is there a way to keep the "undress" button from affecting this, but still keep the sleeves invisible when it reveals other garments and the shirt is on the doll?Should I be making the sleeveless shirt another frame inside the shirt movieclip, rather than a completely separate movieclip? And if so, I know how to go and stop to the next frame using a button, but not sure how to do it with a movieclip.So, I still couldn't get it to work with the shirt as 3 separate movieclips. Instead, I made it all one movieclip with different keyframes, each combination possible on its own frame. And when the jacket moves onto the shirt, it goes and stops to frame 2. When the jacket is not on the x coordinate, it goes and stops to frame 1 again.
View 2 Replies
Similar Posts:
Dec 26, 2008
I've got several layers in the timeline and I'd like to know the most effecient method to toggle the visibility of any one of the layers when a user clicks a button I have on the form.
The layers are all simply graphics that have been imported and the only functino they have on the time line is that they each come in at different times during the playback of the movie. I'd like to have the ability to toggle the individual layer when a user clicks the button.
View 3 Replies
Dec 6, 2010
I'm working on a project that has multiple movie clips and I want to have three buttons, you press button1 and it displays mc1, then you press button2 and it displays mc2 and also hides mc1. same with others so if mc1 is on and you press button3 it will turn mc1 off and turn mc3 on. so any combination only turns on its respective mc.
how to do this without an extraneous amount of code. It will eventually have over 20 buttons, so I want to keep code clean if possible.
View 4 Replies
Mar 26, 2012
I am using YouTube JS API to play videos on my site. Video is played on the dialog box. When user closes the dialog box, player is stopped - player.stopVideo(); But when user clicks again on video icon again, dialog box appears
In Chrome, the video starts playing at the previous position - OK Firefox, the video starts playing from the start irrespective of where user left it last time. - NOT OK
As per my requirements, I want the Chrome to behave as how firefox is behaving.
Here's a fiddle: [URL]
View 1 Replies
Nov 17, 2009
How do I set up an array (or other method), to disable the visibility of a group of movie clips all at once?
I've tried this...
var invisibleMCs:Array = new Array ("MC1", "MC2", "MC3");
invisibleMCs._visible = false;
View 1 Replies
Aug 5, 2010
I'm building an event calendar as part of a website .The calendar is divided into two sections, "calendar" on the right with the actual calendar displayed, and "calendarContent" on the left, where information about the evnts is supposed to show up. The different frames in "calendarContent" are all labeled. Within "calendar" I have different movieclips for each month, and inside each month I put the buttons that open the event descriptions in "calendarContent."
Now, for some reason it's not working. The function I'm trying is the following:
MovieClip(root).pages.calendarContent.gotoAndStop("artsundays");where "pages" is the name of the parent movieclip that "calendar" and "calendarContent" are both inside, and "artsundays" is the label for the frame in "calendarContent" I want to go to. The function is placed within one of the month movieclips. I get the following error:TypeError: Error #1010: A term is undefined and has no properties.I've also tried usng MovieClip(parent) instead of MovieClip(root).pages (since "pages" is the parent), as well as a few other variations, but the problem remained.
View 9 Replies
Nov 19, 2009
I'm attempting to make a "Wheel of Fortune" style game. Everything's going great except this one nagging problem. On the main game board screen (where the word puzzle is solved), I have placed small buttons with all the letters of the alphabet. When the player clicks a certain letter button, the corresponding letters, (if the word or phrase contains them) appear on the board. Well, this works just fine, but as of now, when a letter is chosen, all letters on the board appear at once.
Of course, in the real "Wheel of Fortune" game, if the word or phrase contains 2 or more letters that have been chosen, the letters appear on the board in a sequence, probably around 2 seconds apart (I'm sure most people are familiar with the game show). So, basically, I would love to know how to delay my letter MC's appearing, when the corresponding letter button has been clicked.
View 3 Replies
Apr 3, 2011
What I am trying to do I think is pretty simple.
Consider this code:
ActionScript Code:
var imageContainter:String;
var fileName:String;
[Code]....
This code appears to be working. I'm dynamically creating a bunch of movieclips that each contain an image. The also code stacks each clip on top of each other.
I'd like to be able to now set the alpha or visibility of all of those movieclips to 0 or false, except for the first one. I have other code that will set specific movieclips to display based on mouseEvents.
How do I refer to all of them? And should I be using arrays as well?
View 7 Replies
Jul 12, 2010
I have created a timeline with visibility button against each column. The timeline.swf is loaded into two empty movieclips to create a two-screen operation. Everything works fine except, I cannot for the life of me get the visibility button on the first swf to affect the visibility for the column on the second swf.
[Code]...
View 5 Replies
Jul 6, 2009
2 movie clips MC1 and MC2 . MC2 is placed inside MC1. both the movie clips are having rollover effect. the issue is roll over effect is experienced only for the outer movie clip MC1 but no effect when hover through MC2.
View 1 Replies
Sep 18, 2009
what I'm trying to do is access the data of several movies clips, that are inside of several other movie clips:
MC1.insideMC1._visible=false (which works, but isn't dynamic)
but dynamically with a FOR loop. I've tried:
For(bullet=1; bullet<5; bullet++){
"MC"+bullet.insideMC1._visible=false (this does not work)
}
View 1 Replies
Feb 25, 2006
I have a for loop which duplicates movieclips. To call/create the new clips, I use this:
[Code]....
View 1 Replies
Feb 26, 2010
I got some code to make a video loop indefinitely with the nsvid4_loop function, but i want it t be toggleable via a button I am trying to set up a function to do that (vid4loopwitch).. i'm getting stuck though on how exactly to incorporate the one nsvid4loop with its event listener into the function for repeating it is probably pretty straightforward i'm just still learning my way around AS. check the code to see what i have so far.. i just need to know what i need to add to the vid4loopswitch function to get it going. it is really hurtin my brain
var nsvid4:NetStream = new NetStream(nc);
nsvid4.client = this;
nsvid4.play("clips/video1.flv");
[code].....
View 4 Replies
Jul 14, 2011
how to do it but i'm not sure how to implement. I basically have one button that when i click with need to trigger a function. When I click it again it will trigger a second function and will keep this up back and forth.
View 3 Replies
Aug 5, 2004
how to communicate with those clips specifically to make them draggable and also to change the _rotation with Key.Right, Key.Left.
View 7 Replies
May 5, 2009
I am new to AS, but not new to programming.I'm using Flash CS4.I have two button symbols, PlayBTN and PauseBTN. They are used to control the playback of a slideshow. When I use either one or the other to control the slideshow, it works. However, what I want to do is toggle between the two buttons, so that they work together like this:
1. If the slideshow is playing, PauseBTN is visible. If PauseBTN is clicked, the slideshow stops, and PlayBTN becomes visible.
2. If the slideshow is paused, PlayBTN is visible. If PlayBTN is clicked, the slideshow stops, and PauseBTN becomes visible.
In other words, clicking the button not only controls the slideshow, but changes which button is visible.I had this working using a two-frame movie clip and static bitmaps, but when I swap out the bitmaps for the buttons, the button rollovers stop working.
View 8 Replies
Aug 25, 2011
I have a button in action script with toggle="true". Now when I click the button its color changes and it looks as if it has been disabled (but its actually not). I need to know which property of this button has changed? For example if I need to know somewhere in my code the "toggled state" (if there is any such thing) of this button, which property of this button should I check?
View 1 Replies
Feb 11, 2011
I have 4 buttons on the stage and each button is correlated to a seperate movieclip.
btn1 - mc1
btn2 - mc2
btn3 - mc3
btn4 - mc4
I want each mc to appear when it's corresponding btn is clicked but it has to be the only mc on the stage...meaning whatever mc was currently has to disappear. I've toyed with numerous was to get this to work but I know there's a more code efficient way to do this than the code I have below. And I don't want to use any timeline.
[Code]....
View 3 Replies
Mar 23, 2011
I have created a Pause and Play button that toggles between states. It controls a Timeline with synced Sound. When I use it the sound and animation go out of sync. Can anyone help me with this or perhaps have better code I could swap out to make this work?
Below is what I am currently using:On the first frame of an Action Script layer put this AS:
playBtn.onRelease = function() {
ns.pause(false);
playBtn._visible = false;
pauseBtn._visible = true;
[code]....
Put the Pause and Play buttons directly over each other on 2 layers for the duration of the timeline.Pause Button on top. (unless you have a STOP on the first line then maybe the Play button will start it.
View 3 Replies
Oct 7, 2009
How do you deal with toggling multiple buttons? When one button clicks on the previous active button(s) turns off.
What is the standard practice for dealing with this? Have listeners on all the buttons checking if their name is in an activeButton variable (which seems process intensive with all those listeners going)
A FOR loop to go through all the buttons states and check the activeButton variable when any button is clicked?
That is two ways I have done it but I think there has to be other ways that might be more elegant.
View 3 Replies
Jul 21, 2010
This is a completely AS3 scripted, and dynamic project, meaning I cant use any assets from the library.
1 - This button is a mute. � Currently the loaded sound now fades in with a timer.� I want the button to over-ride any sound elements on the stage: the mp3 and later a flv movie as well.� In the below example the button only interferes with fade, and dosen't actually override it, after the fade - it dont do jack. � SoundMixer.stopAll(); will of course kill everything but I cant toggle this(can I?)
2 - The toggle button itself � I've loaded two png's into a sprite, and created a toggle button from them using an if statement. � Is this best practice? or would you recommend something else?� Perhaps SimpleButton?
ActionScript Code:
var btmUpURL:String = "a_icn-1.png";
var btnDwnURL:String = "a_icn-0.png";
var btnLoader1:Loader = new Loader();
var btnLoader0:Loader = new Loader();
[code].....
View 9 Replies
Oct 12, 2011
I've landed a project which is centered around building a custom video player with some special functionality (so I can't just use the default Flash video player, unfortunately). I have two small 'problems' in the sense that I could probably solve them myself, but I'd like some input on best practice for solving them:(The project is for Flash Player 10 and the video is intended to run inside a browser.)
Toggling between normal / fullscreen playback Ok, so my custom video player needs to be able to toggle between fullscreen and normal embedded-in-webpage player size. How does fullscreen toggling currently work in AS3 -is there a specific AS3 method for fullscreening a specified video object in the swf (without stretching the video player UI in the swf itself), and if so, does it automatically black out the background if the screen format doesn't match the video format? - or do I need to download a class for this?
Positioning video player UI when going fullscreen As opposed to YouTube, I want the player UI to still show up when the video is toggled to fullscreen mode - but as mentioned above, I don't want to stretch its size along with the video. So is there a best practice for repositioning the video player UI to the vertical bottom and horizontal center of the screen when the user clicks full screen? I'm not entirely familiar with what happens to the Flash stage when it goes full screen,. How to deal with not knowing the coordinates of the vertical bottom/horizontal center when screens have different ratios and resolutions?
View 3 Replies
Sep 11, 2010
This code is written in simple ActionScript, but I'm assuming this problem of mine would occur in all languages that have boolean datatypes. I'm simply clicking the stage so that my boolean variable reverses its value and than traces/prints/logs it's new value. However, it's always tracing true instead of switching between true and false for each mouse click.
var myBool:Boolean;
stage.addEventListener(MouseEvent.CLICK, mouseClickHandler);
function mouseClickHandler(evt:MouseEvent):void {
changeBoolean(myBool);
} function changeBoolean(boolean:Boolean):void {
boolean = !boolean;
trace(boolean);
}
View 2 Replies
Oct 12, 2011
I've landed a project which is centered around building a custom video player with some special functionality (so I can't just use the default Flash video player, unfortunately). I have two small 'problems' in the sense that I could probably solve them myself, but I'd like some input on best practice for solving them: (The project is for Flash Player 10 and the video is intended to run inside a browser.)
Problem 1: Toggling between normal / fullscreen playback Ok, so my custom video player needs to be able to toggle between fullscreen and normal embedded-in-webpage player size. How does fullscreen toggling currently work in AS3 -is there a specific AS3 method for fullscreening a specified video object in the swf (without stretching the video player UI overlay), and if so, does it automatically black out the background if the screen format doesn't match the video format? - or do I need to download a class for this?
Problem 2: Positioning video player UI when going fullscreen As opposed to YouTube, I want the player UI to still show up when the video is toggled to fullscreen mode - but as mentioned above, I don't want to stretch its size along with the video. So is there a best practice for repositioning the video player UI to the vertical bottom and horizontal center of the screen when the user clicks full screen? I'm not entirely familiar with what happens to the Flash stage when it goes full screen, How to deal with not knowing the coordinates of the vertical bottom/horizontal center when screens have different ratios and resolutions?
View 3 Replies
Jan 19, 2012
I'm trying to toggle 2 global Boolean variables inside of an ENTER FRAME loop. "Eating" and "WasEating". When these 2 objects hit each other "Eating" is set to true, and an animation plays to show that my character is eating. When the 2 objects DONT hit, I want to change my "WasEating" variable to true ONLY for that one frame (then setting it back to false), and to change back to the original animation when the Hero was NOT eating.
The issue I'm having is my variable is getting toggled true to false, false to true, every frame, not what I want. I want to have this happen ONLY ONCE, based on the hitTestObject function in the loop. For example:
ActionScript Code:
addEventListener(Event.ENTER_FRAME, loop);
function loop (e:Event):void {
[Code]...
View 2 Replies
Feb 15, 2012
I'm trying to create an image gallery by toggling between different sets of thumbnails and thus loading the appropriate images.I've set up the first 9 okay and they all load at first but when I toggle back and forth in the toggleThumbnails function using addChild I can no longer load these same movieclips.I'm loading the same movieclip with their associated instance names? How come it no longer interacts with the thumbnails?
ActionScript Code:
import flash.events.MouseEvent;
var thumbnailSet = "setOne";[code].....
View 2 Replies
Jul 21, 2010
This is a completely AS3 scripted, and dynamic project, meaning I cant use any assets from the library.
1 - This button is a mute.
� Currently the loaded sound now fades in with a timer.� I want the button to over-ride any sound elements on the stage: the mp3 and later a flv movie as well.� In the below example the button only interferes with fade, and dosen't actually override it, after the fade - it dont do jack. � SoundMixer.stopAll(); will of course kill everything but I cant toggle this(can I?)
2 - The toggle button itself� I've loaded two png's into a sprite, and created a toggle button from them using an if statement. � Is this best practice? or would you recommend something else?� Perhaps SimpleButton?
[code]....
View 1 Replies
Jan 15, 2009
For loop generates clips containing clips. I need to access a specific clip (look_back) within the parent clip generated by the loop. Not sure how to do this.[code]
View 1 Replies
Apr 11, 2007
I have two main clips with clickable clicks within each. I am using swapDepths on the two main clips in a tab navagation fashion. The problem is that if I click on the space between the nested clips in the top clip it actually is hitting the buttons(movieclips) on the other clip under it. Any suggestions?
View 1 Replies
Apr 26, 2011
I have used states in my application.The thing is I have made the first item in my list to be selected. so I gave like this,
if(itemIndex == 0)
this.currentState="selected";
this works fine.The problem is when other item is selected the first item does not change its state,it remains in the selected state until its clicked.My code looks like this,
<s:BorderContainer id="outerCont" width="275" height="100" borderVisible="false"
backgroundColor.normal="#3D3C3C" backgroundAlpha.selected="0.1"
backgroundColor.selected="{data.color}">
My states are like this,
<s:states>
<s:State name="normal" />
<s:State name="hovered" />[code]........
View 1 Replies