Movieclip btn question

Hi there,
Can anyone tell me how I go about making my movieclip buttons
stay in over state while they at their destination? For example, if
I'm on my about page in my website how can I get my about button to
stay in it's over state, then go back to it's normal state when
another button is clicked and I go to a different page? I hope I
explained that ok, the only way I can think of doing it is really
long winded and I wondered if there was a better way. Below is the
code for one of my buttons.
Thanks in anticipation.

if you construct a MC button that has labels of '_up',
'_over', and '_down' and then apply a single handler like onRelease
or onPress - Flash will recognize that you are using the MC as a
button and respond to the mouse events without have to declare the
other handlers.
Then, in your onRelease handler, tell the button to
gotoAndStop('_down) (or over in your case) and then use the
'enabled' prop to disable the button. Now however you will need a
method to 're-enable' any other button that was previously disabled
- best thing to do is to store the buttons in an array and then
iterate through the array a 'enable' all of them with the exception
of the one currently navigated to.

Similar Messages

  • MovieClip btn problems

    I have a movieClip btn with a rollOver and rollOut animations
    (motion-tweens) . It work fine until I move the mouse too fast over
    the btn than it gets stuck in the 'over' position. Does anyone know
    why this happens?
    here's the code I'm using -
    on (rollOver) {
    //Movieclip GotoAndStop Behavior
    this.gotoAndPlay("over");
    //End Behavior
    on (rollOut) {
    //Movieclip GotoAndStop Behavior
    this.gotoAndPlay("out");
    //End Behavior
    Thanks for any help,
    Dave

    if you construct a MC button that has labels of '_up',
    '_over', and '_down' and then apply a single handler like onRelease
    or onPress - Flash will recognize that you are using the MC as a
    button and respond to the mouse events without have to declare the
    other handlers.
    Then, in your onRelease handler, tell the button to
    gotoAndStop('_down) (or over in your case) and then use the
    'enabled' prop to disable the button. Now however you will need a
    method to 're-enable' any other button that was previously disabled
    - best thing to do is to store the buttons in an array and then
    iterate through the array a 'enable' all of them with the exception
    of the one currently navigated to.

  • Clip Mask and MovieClip pivot questions

    Two more beginner questions:
    1) What's the easiest way to invert a clipping mask for a
    MovieClip in ActionScript? I tried using a ColorTransformMatrix to
    invert the alpha of the mask MovieClip, but it didn't work (looks
    like the clip mask simply does nothing where there are no filled
    shapes). I would like to add a graphic everywhere EXCEPT within the
    area of an animated MovieClip, and due to various requirements I
    cannot simply place it behind that MovieClip.
    2) Is there a way to set the pivot of a MovieClip in relation
    to the animated drawings/frames? It looks like the "origin" of a
    movieclip is the lower left-most corner of all the bounding boxes
    of all the frames of animation in my MovieClip. So if I set the _x
    and _y of a MovieClip in ActionScript to 150,150 it places the
    lowerleft-hand corner there instead of what I would like to be
    logical center of the MovieClip (say, center of a wheelbase of a
    car, or center of the feet of a person, or center of mass of a
    rock). I am fine with dialing in an offset, but just wondering if
    there is a cleaner way to do it (esp. if I happen to add more
    animation frames or replace drawings and the bounding box changes
    size).
    Thanks,
    Ken

    Ah, I figured everything out.
    1) Actually, the ColorTransformMatrix does work, but I didn't
    realize that alpha was 0-255, not 0-1 (you'd think after being
    bitten by MovieClip scales being 100 = 100% instead of 1 = 100%,
    I'd have guessed, but...). So a ColorTransformMatrix of
    (1 0 0 0 0)
    (0 1 0 0 0)
    (0 0 1 0 0)
    (0 0 0 -1 255)
    applied to the mask will successfully invert it. Nice.
    2) Apparently I had previously messed up grabbing all the
    images and dragging them - I had forgotten to turn onion skinning
    to "onion all" so that I could actually see everything (all my
    images are all on top of each other so it wasn't obvious I didn't
    have everything visible). I had been selecting all the frames and
    dragging the images around in relation to the registration point,
    but only the last 3 frames were actually moving, and they happened
    to be a part of the animation I didn't bother triggering while
    testing. Oops.
    Thanks much for your help.
    Ken

  • MovieClip coding questions

    I'm only a few days into Flash 8, and I'm a little confused
    about conceptually what "MovieClips" should be, and was hoping to
    get a few quick answers:
    1) I was looking through the sample code and it looks like
    they are creating new graphical items through this.attachMovie(),
    and I'm not sure what "this" is since the code is just written in
    the actions panel in frame 1. (I know what "this" means from a
    programming standpoint; I'm just not sure what object scope the
    code that's running there is in). What object am I "in" in code
    that's just sitting around at frame 1 of the main scene timeline?
    2) It says I can make a subclass of a MovieClip, which is
    what I want to do to make little animated controllable characters
    (e.g. "class Car extends MovieClip", but I don't understand how to
    instantiate them within actionscript. According to the docs, you
    don't use constructor methods to make MovieClips, but instead use
    attachMovie() or createEmptyMovieClip() or duplicateMovieClip(). So
    how do I make an object of class Car? attachMovie() returns a
    MovieClip, and I can't cast that to a Car class.
    3) Just curious how people generally organize their code (and
    Symbols) with respect to MovieClips, in the case of, say a moving
    car in a game application. Do MovieClips tend to represent single
    animations (e.g. one MovieClip of a car with the wheels rotating
    left, one where the wheels rotate right, one where it crashes, and
    they get created and destroyed every time the car's state changes)?
    or single objects (e.g. one MovieClip containing many short
    animations along the timeline: one rolling left, one right, one
    crashing, with labels and "goto" action scripts to loop animation,
    etc.)?
    4) What is the purpose of empty movie clips? Do people use
    them like I would use a transform node in Maya or a null node in
    Lightwave (e.g. just a pivot to stack transformations?)?
    Thanks, and pardon the screen name - I was having issues
    choosing a screenname with Firefox and tried a gibberish test in IE
    and oops, it worked, and I can't figure out how to change it to a
    real screenname. So apparently I am stuck as "asdfhabsaf".
    Ken

    1. The main timeline is itself a MovieClip. So, 'this' on the
    main timeline
    refers to the main timeline... It just removes any ambiguity.
    2. In the library, right-click the movieClip and select
    linkage. There you
    click 'export for ActionScript' and the class field will
    become available.
    That's where you put a reference to your class.
    3. Really depends on you and the projects needs.
    4. Empty clips are useful for place holders, to load external
    content into.
    And yes, somewhat like Maya... you can load multiple clips
    into one clip,
    and then move all clips by moving the one parent.
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Movieclip loader question

    Hi,
    I just used the movie clip loader class to load a swf
    dynamically, and oddly, the width and height are zero even as i'm
    looking at the loaded clip too large for the area i'm loading it
    into. Is there any way around this?
    thanks
    e

    yes, but unfortunately, the width and height at that point a
    very different from what i need them to be when onLoadComplete is
    called...i suppose i could just hard code the values since i know
    what they will be in the end, but that defeats the purpose...after
    the movie is fully loaded i scale it to fit in an area on the
    stage...my scale values are completely out of whack (infinity)
    because when onLoadComplete is called...the values are 0 instead of
    1024x768...is this a bug...did i just find a bug? if not...why does
    my empty movie clip have values of 353x39
    confused obviously
    e

  • Movie clips inside an animated movieclip

    Hello- I have been trying to get movieclip buttons inside an
    action script animated movie clip to work and have no luck doing
    so. The inside movieclips act as if they dont have over or out
    states; but when i comment out the animation, they work fine...
    here is my code- (Please note im am a newbe at action script so any
    suggestions on improving current code will be greatly appreciated)
    stop();
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    function upFunction() {
    var xPosT:Tween = new Tween(kText, "_x", Strong.easeOut,
    kText._x, 400, 1, true);
    function downFunction() {
    var xPosT:Tween = new Tween(kText, "_x", Strong.easeOut,
    kText._x, 200, 1, true);
    kText.btn.onRelease = function():Void {
    _root.play();
    kText.onRollOver = function():Void {
    upFunction();
    kText.useHandCursor = false;
    kText.onRollOut = function():Void {
    downFunction();
    kText is the animated movieclip, btn is the button inside
    kText
    Thanks!

    if you define any mouse handlers for a parent movieclip (like
    kText) it will intercept all mouse events so child movieclips (like
    kText.btn) do not see the mouse events.
    to remedy define all mouse handlers for shapes (converted to
    movieclips), buttons and movieclips on kText's timeline or use a
    loop with hitTest one the parent or child

  • Class Inside MovieClip Giving Runtime Error

    Hey guys.
    I'm trying to place an instance of a movieclip (instance
    name: tehMovieClip) from the library within another movieclip
    (instance name: parentMovieClip) on the stage. tehMovieClip, the
    movieclip going inside another movieclip, belongs to a class called
    CollisonDetection (linkage properties, class:CollisonDetection,
    Base Class: flash.display.MovieClip). When I put tehMovieClip
    inside parentMovieClip, I get this runtime error:
    TypeError: Error #1009: Cannot access a property or method of
    a null object reference.
    If I just place tehMovieClip on the stage by itself, it works
    fine but I need it to be inside parentMovieClip. So what should I
    do?
    Just for your information, CollisonDetection extends the
    project's DocumentClass which extends MovieClip.
    Thanks in advanced!

    Thanks for that buddy.
    quote:
    Originally posted by:
    SwapnilVJ
    Is the movie clip your are placing linked from library to a
    class?
    The movieclip in question (the one I am placing inside
    another movieclip) is linked to a class.
    quote:
    Originally posted by:
    SwapnilVJ
    If yes. Is the Class linked to the movieclip have a
    Constructor method with parameters?
    Well this is my current constructor:
    public function CollisonDetection() {
    playerRefFromCollisonDetection.x = 600;
    Now that you've said that, I deleted that middle line and it
    seemed to work
    quote:
    Originally posted by:
    SwapnilVJ
    If Yes. you found the problem.
    And solution will be to update the class' constructor to have
    no parameters.
    Thanks buddy, but what if I need to have statements inside
    the constructor such as triggering methods/functions inside the
    class?

  • Find the frame number of a label?

    Is it possible to find out the first frame of a label without going there then put it in a variable in AS2 or AS3?
    Thanks for the help,

    I actually had the same question. I've worked out a way of doing it in AS3.
    So first you can get all the frame labels on the MovieClip in question by using the currentLabels property (http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/MovieClip.html). Then going through the array you can find your label as a FrameLabel object which has a frame property that will tell you the frame number (http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/FrameLabel.html).
    Hope that helps

  • WORKING WITH TIMELINES

    Hi
    I have a game designed in flash using the Object Oriented Approach. This implies I have various classes with a main class.
    I also have two versions of the game collaborative and non-collaborative which can be palyed using three different game controllers. so in total I have 6versions as shown below:
    collaborative palyed with gamepad
    collaborative played with wiimote
    collaborative played withbalance board
    non- collaborative palyed with gamepad
    non-collaborative played with wiimote
    non-collaborative played withbalance board
    Now I want to have a screen with links to all these verions for example when I run the game I want to get an intro screen with the versions written on it and then with button clicks play the particular version I want.  Can I do this on the Timeline. if possible what is the procedure?

    in your new main swf:
    var loader:Loader=new Loader();
    addChild(loader);
    var a:Array=[collaborative_palyed_with_gamepad_btn,collaborative_played_with_wiimote_btn,coll aborative_played_withbalance_board_btn,non__collaborative_palyed_with_gamepad_btn,non_coll aborative_played_with_wiimote_btn,non_collaborative_played_withbalance_board_btn];  // <-create those movieclip btns
    for(var i:int=0;i<a.length;i++){
    MovieClip(a[i]).addEventListener(MouseEvent.CLICK,clickF);
    MovieClip(a[i]).ivar=i;
    MovieClip(a[i]).buttonMode=true;
    function clickF(e:MouseEvent):void{
    var ivar:int=MovieClip(e.currentTarget).ivar;
    loader.load(new URLRequest(a[ivar].split("_btn").join(".swf"));  // assuming your swfs are named collaborative_palyed_with_gamepad.swf (sic) etc

  • DropShadowFilter not rendering

    I scripted a DropShadowFilter to render on my Movie Clip. The MC just consists of static text and its using the Tween class to move on the screen. Can't figure out why its not showing up. I'm using the same method on another movie clip that is just images, and works fine. Not generating any errors either.
    Code:
    import flash.filters.*;
    var tds:DropShadowFilter = new DropShadowFilter(3,90,0x000000,40,3,3,1,3,false,false,false);
    tags.filters = [tds];
    Movieclip in question is called "tags". Using AS2 and CS3
    Any ideas??

    Ok! The problem came back again, but I corrected it by creating MCs out of all the text within the container MC.
    So instead of having:
    tag > text1, text2, text3
    I have:
    tag > text1MC, text2MC, text3MC
    So my code now looks like this:
    import flash.filters.*;
    var tds:DropShadowFilter = new DropShadowFilter(3,90,0x000000,40,3,3,1,3,false,false,false);
    tags.s1.filters = [tds];
    tags.s2.filters = [tds];
    tags.s3.filters = [tds];
    tags.s4.filters = [tds];
    You would think you can just add the filter to the entire containing MC tags, but it has proved to be buggy, at least on my computer.

  • DropShadowFilter on Air for Android

    Hi all,
    Is there a known issue with publishing air applications to android that use filters (i.e. DropShadowFilter, BlurFilter) ? As when I try publishing to my phone, the movieclips in question do not even render to the stage, which is strange considering they work fine when I preview them as an SWF on my computer. I've tried applying the filters in the CS5 library, and doing it using code in my document classes and neither seems to work! I've obviously tried with cacheAsBitmap(Matrix) both on and off as well.
    Just wondering if its something that isn't supported? Or if there's a way round it?
    Thanks.

    Check you've got renderMode set to 'cpu'?
    Filters and 'gpu' don't play together at all, I believe.

  • Problems using addchild method to dynamically load buttons

    Hello,
    I have researched the internet for about a week now losing sleep trying to figure this out.  Can someone help me?  I have an fla file with Quiz question.  For example:
    on frame 50 I have images and radio buttons, a submit button with an instance name of submit_btn with the question The first capital of the United States
    was New York City as a static text.  The action for this frame is:
    stop();
    import fl.controls.RadioButtonGroup;
    var radioGroup1:RadioButtonGroup = new RadioButtonGroup("TriviaQuestion 1");
    rb3.textField.autoSize = TextFieldAutoSize.LEFT;
    rb1.label="True";
    rb2.label="False";
    rb3.label="NY is not in the US";
    rb4.label="NY is a City";
    rb1.group=radioGroup1;
    rb2.group=radioGroup1;
    rb3.group=radioGroup1;
    rb4.group=radioGroup1;
    submit_btn.addEventListener(MouseEvent.CLICK, submitClick);
    function submitClick(event:MouseEvent):void {
    if(radioGroup1.selection == null) {
    return;
    if(radioGroup1.selection.label == "True") {
    status_txt.text=radioGroup1.selection.label+ " is correct! Well done.  The first capital of the United States was New York City in 1789.";
    }else {status_txt.text=radioGroup1.selection.label+ " is incorrect! Try Again.";
    next_btn.addEventListener(MouseEvent.CLICK, nextOnClick);
    function nextOnClick(event:MouseEvent):void
    gotoAndPlay(55);
    Now my movie works fine this way.  What I want to do is practice adding the navigations (prevButton, nextButton and finishButton) with the addchild button in an AS file (linking it in the document properties).  I have done this if I add the questions as well but a little confused on how to make the navigation work if the questions are already on a time line.  So far this is what my ClassButton.as file looks like  (can't figure out how to import the questions);  If I get the prevhandler correct, the rest will be easy.
    package
    import flash.display.MovieClip;
    //import flash.display.Sprite;  <<fla file went crazy when I used Sprite verses MovieClip
    import fl.controls.Button;
    import flash.events.MouseEvent;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import fl.controls.RadioButtonGroup;
    public class ClassButton extends MovieClip {
    //handling questions: --this is the big problem..don't know how to import RadioButtonGroups
    private var quizQuestions:RadioButtonGroup;
    //private var currentQuestion:QuizQuestions;
    //private var radioGroup:RadioButtonGroup;
    private var currentIndex:int = 0;
    //buttons:
    private var prevButton:Button;
    private var nextButton:Button;
    private var finishButton:Button;
    //scoring and messages:
    private var score:int = 0;
    private var status:TextField;
    public function ClassButton() {
    createButtons();
    //createQuestions();
    /* little confused on what function to create to add questions
    private function createQuestions() {
    radioGroup = new RadioButtonGroup;
    //create previous, next and finish button
    private function createButtons() {
    var yPosition:Number = 505;
    prevButton = new Button();
    prevButton.label = "Previous";
    prevButton.x = 50.35;
    prevButton.y = yPosition;
    prevButton.addEventListener(MouseEvent.CLICK, prevHandler);
    addChild(prevButton);
    nextButton = new Button();
    nextButton.label = "Next";
    nextButton.x = prevButton.x + prevButton.width + 40;
    nextButton.y = yPosition;
    //nextButton.addEventListener(MouseEvent.CLICK, nextHandler);
    addChild(nextButton);
    finishButton = new Button();
    finishButton.label = "Finish";
    finishButton.x = nextButton.x + nextButton.width + 40;
    finishButton.y = yPosition;
    //finishButton.addEventListener(MouseEvent.CLICK, finishHandler);
    addChild(finishButton);
    private function showMessage(theMessage:String) {
    status.text = theMessage;
    status.x = finishButton.x + finishButton.width + 40;
    status.y = 505;
    /* blocked this out because it's incorrect.  the problem is the property (currentQuestion and quizQuestion)
    private function prevHandler(event:MouseEvent) {
    showMessage("");
    if(currentIndex > 0) {
    currentQuestion.visible = false;
    currentIndex--;
    currentQuestion = quizQuestions[currentIndex];
    currentQuestion.visible = true;
    else {
    showMessage("There are no previous quesions. This is the first question.");
    How do I make these buttons - next, prev and finish -  work for the questions using the addchild method in a separate AS file linked to the FLA file?  Is there a way to import the RadioButtons?  Is this possible.

    Check out this Nugget.
    It contains code that should help you get started.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Help with XML and Oracle 8i

    Hi Oracle XML Team,
    I really need to understand clearly about how 8i supports XML.
    Please help to answer the following questions quickly.
    1) Using the available components such as XML SQL utilities, XML
    Class gen, Parser and the Servlet. Can I use all this to develop
    an application to retrieve, store and query XML doc in 8i (do I
    need any components such as intermedia)?
    2) The licensing scheme for all the above 4 four components
    stated that it is not for commercial use? But what if I need to
    deploy my application soon ? Is there a separate licensing
    scheme for deployment?
    3) I am using 8i standard edition now, if I would to use
    iFS/intermedia....do I need to get the Enterprise Edition?
    Please help me. Thank you very much
    Sam
    null

    i think you want something along the lines of :
    stageFade_mc.swapDepths(theMovieOnTopAtTheMoment);
    Note that only dynamically created movies have depths. So if
    either of the movieclips in question are just sitting in your
    timeline you cant swap their depths.
    In that case you either need to duplicateMovieClip() or just
    set things _visible property where apropriate.
    good luck
    jon

  • Help with xml and getNextHighestDepth

    I have a thumbnail gallery that is called in with xml- On
    stage is a movieClip that covers the entire thumbnail area with the
    alpha set to 0. what I'm trying to do is onRelease- have that mc
    brought to the front and it's alpha state tween to 100- i've not
    much experience using 'getNextHighestDepth' so I'm assuming
    something is wrong here... if anyone can help I'd really appreciate
    it!
    Thanks!

    i think you want something along the lines of :
    stageFade_mc.swapDepths(theMovieOnTopAtTheMoment);
    Note that only dynamically created movies have depths. So if
    either of the movieclips in question are just sitting in your
    timeline you cant swap their depths.
    In that case you either need to duplicateMovieClip() or just
    set things _visible property where apropriate.
    good luck
    jon

  • Arranging pop-up menus so never hidden

    Hi,
    Would be very grateful if someone can explain to me how to
    stop the pop-up menues on the nav bar being obscured by the flash
    clip I've put on th home page. I've tried bringing the nav bar and
    pop-up menues to the front.
    I'm using tables not layers.
    thanks,
    Lucinda

    This is *NOT* a z-index problem.
    It's the fundamental behavior of Active content compared to
    ordinary HTML
    content. Jo has the right answer.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "WebXperience" <[email protected]> wrote in
    message
    news:em3p03$isa$[email protected]..
    > It all depends upon if the two movieclips in question
    (the navbar
    > movieclip and the flash clip) are on the same timeline.
    If so, load your
    > navbar menu in a higher level than your flash clip.

Maybe you are looking for