Targeting movie clips

Hello everyone,
I've worked on some code with a little help from some people
here and I've gotten everything to work. The problem I am having
right now is getting my cross fading images to sit inside separate
movie clips that are on my home .swf. The code I have so far is as
follows:
var showTime:Number = 5000 // milliseconds the picture shows
at 100% alpha.
mc_Mon1 = createEmptyMovieClip("img1_mc", 0);
loadMovie("images/home/image01.jpg", img1_mc); // load
picture from the file directory that your .swf is in.
mc_Mon1 = createEmptyMovieClip("img2_mc",
getNextHighestDepth());
loadMovie("images/home/image02.jpg", img2_mc);// load picture
from the file directory that your .swf is in.
img2_mc._alpha = 0; // hide 2nd picture
var duration:Number = 30; // milliseconds per alpha change
(framerate).
var count:Number = 0;
var alphaPhase:Number = 1;
var alphaCount:Number = 0;
function picSwap():Void {
count++;
if(count >= (showTime/duration)) {
alphaCount += alphaPhase;
img1_mc._alpha = 100-alphaCount;
img2_mc._alpha = alphaCount;
trace("img1 alpha: " + img1_mc._alpha);
trace("img2 alpha: " + img2_mc._alpha);
if(alphaCount >= 100 || alphaCount <= 0) {
count = 0;
alphaPhase *= -1;
var intervalId:Number = setInterval(picSwap, duration);
// End of script.
I am trying to make img1_mc and img2_mc sit inside mc_Mon1.
So I am thinking that I would need mc_Mon1 to
"createEmptyMovieClip" named "img1_mc and img2_mc. I thought thats
what I did with the code but so far my cross fading images just sit
up on the top left of the screen. Does anyone have any idea how to
set the target movie clip to load the other movie clips?
Thanks,
Kyle

hi,
you should make few changes in your code for it to work,
starting with this:
instead of - "mc_Mon1 = createEmptyMovieClip("img1_mc", 0);"
and the
following line, try - mc_Mon1.createEmptyMovieClip("img1_mc",
mc_Mon1.getNextHighestDepth());
mc_Mon1.img1_mc.loadMovie("images/home/image01.jpg");
and then -
mc_Mon1.createEmptyMovieClip("img2_mc",
mc_Mon1.getNextHighestDepth());
mc_Mon1.img2_mc.loadMovie("images/home/image02.jpg");
mc_Mon1.img2_mc._alpha = 0;
and then in picSwap function, it should be -
mc_Mon1.img1_mc._alpha = 100-alphaCount;
mc_Mon1.img2_mc._alpha = alphaCount;
that should do it i think.
just so you'd learn, in your original code, 'mc_Mon1'
actually is variable
reffering to 'img1_mc' (which, if i'm not mistaken, is
created in _level0),
but then 2 lines later you overwrite the refference to
'img1_mc' with a
refference to 'img2_mc' (which is also created in _level0).
one more thing which i didn't check - when you declare you
'intervalId',
don't u need to use 'showTime' instead of 'duration'?
good luck,
eRez
"kypsul" <[email protected]> wrote in
message
news:[email protected]...
> Hello everyone,
>
> I've worked on some code with a little help from some
people here and I've
> gotten everything to work. The problem I am having right
now is getting my
> cross fading images to sit inside separate movie clips
that are on my home
> .swf. The code I have so far is as follows:
>
> var showTime:Number = 5000 // milliseconds the picture
shows at 100%
> alpha.
> mc_Mon1 = createEmptyMovieClip("img1_mc", 0);
> loadMovie("images/home/image01.jpg", img1_mc); // load
picture from the
> file
> directory that your .swf is in.
>
> mc_Mon1 = createEmptyMovieClip("img2_mc",
getNextHighestDepth());
> loadMovie("images/home/image02.jpg", img2_mc);// load
picture from the
> file
> directory that your .swf is in.
>
> img2_mc._alpha = 0; // hide 2nd picture
>
> var duration:Number = 30; // milliseconds per alpha
change (framerate).
> var count:Number = 0;
> var alphaPhase:Number = 1;
> var alphaCount:Number = 0;
>
> function picSwap():Void {
> count++;
> if(count >= (showTime/duration)) {
> alphaCount += alphaPhase;
> img1_mc._alpha = 100-alphaCount;
> img2_mc._alpha = alphaCount;
> trace("img1 alpha: " + img1_mc._alpha);
> trace("img2 alpha: " + img2_mc._alpha);
> if(alphaCount >= 100 || alphaCount <= 0) {
> count = 0;
> alphaPhase *= -1;
> }
> }
> }
> var intervalId:Number = setInterval(picSwap, duration);
> // End of script.
>
> I am trying to make img1_mc and img2_mc sit inside
mc_Mon1. So I am
> thinking
> that I would need mc_Mon1 to "createEmptyMovieClip"
named "img1_mc and
> img2_mc.
> I thought thats what I did with the code but so far my
cross fading images
> just
> sit up on the top left of the screen. Does anyone have
any idea how to set
> the
> target movie clip to load the other movie clips?
>
> Thanks,
>
> Kyle
>
>

Similar Messages

  • Target movi clip in separate swf

    Hi, i am updating a website and am trying to move the "skip"
    button to appear earlier. To do this I have to move the button to
    another swf file.
    now I can load the swf (dbo.swf) into an empty movie clip
    (named empty_mc) easily enough, but I am trying to target different
    things to happen inside of the newly loaded swf instead of playing
    from the beginning. I tried this:
    on (release) {
    empty_mc.loadMovie("swfs/dbo.swf");
    empty_mc.boxes_mc.gotoAndPlay("quickbuild");
    empty_mc.gotoAndPlay("jump_home");
    empty_mc.stopAllSounds();
    ...but it still plays from the first frame of dbo.swf instead
    of playing the appropriate movies and frames. any suggestions?

    When I load in a new .swf file into my main movie, it appears to load on top of the main movie.
    This is the load function that we set up:
    this.createEmptyMovieClip("target1MC",this.getNextHighestDepth());
    this.createEmptyMovieClip("target2MC",this.getNextHighestDepth());
    var currMC:MovieClip = target2MC;
    target1MC._alpha = 0;
    function loadF(y:Number, d:Number) {
    otherTargetF(currMC).swapDepths(Math.max(target1MC.getDepth(), target2MC.getDepth()));
    mcl.loadClip("floors_swf/"+y+"_"+d+".swf",otherTargetF(currMC));
    Is there a way to get the .swf file that gets loaded in to load behind the graphics in my main movie?
    It appears to be loading into the target1MC, but I don't see where to set the level that it loads into?
    Thanks

  • Target movie clip fade within function

    I'm working with this function that is loading in different .swf files based on buttons that are clicked:
    this.createEmptyMovieClip("targetMC",this.getNextHighestDepth());
    function loadF(y:Number, d:Number) {
    targetMC.loadMovie("floors_swf/"+y+"_"+d+".swf");
    I want the targetMC to fade in and out, can I add that functionality into the function above
    or is that something that needs to be done in each .swf file that I'm loading in?

    When I load in a new .swf file into my main movie, it appears to load on top of the main movie.
    This is the load function that we set up:
    this.createEmptyMovieClip("target1MC",this.getNextHighestDepth());
    this.createEmptyMovieClip("target2MC",this.getNextHighestDepth());
    var currMC:MovieClip = target2MC;
    target1MC._alpha = 0;
    function loadF(y:Number, d:Number) {
    otherTargetF(currMC).swapDepths(Math.max(target1MC.getDepth(), target2MC.getDepth()));
    mcl.loadClip("floors_swf/"+y+"_"+d+".swf",otherTargetF(currMC));
    Is there a way to get the .swf file that gets loaded in to load behind the graphics in my main movie?
    It appears to be loading into the target1MC, but I don't see where to set the level that it loads into?
    Thanks

  • Controlling a movie clip timeline

    I am using a loaded movie clip in my movie. This script is on
    a button:
    loadMovie("largeWorks_mc.swf",_root.largeWorksE_mc);
    Why can''t I control this loaded movie clip from a button in
    another movie clip:
    large1_btn.onPress = function (){
    _root.largeWorks_mc.gotoAndStop(5);

    quote:
    Originally posted by:
    Opera Rat
    Yes, I'm loading largeWorks_mc into the target movie clip
    _root.largeEmpty_mc.
    Let me see if I can explain this better. If you look at the
    old version (the one that loads the entire flash file at once), you
    can see the different areas of the movie I am talking about. You
    can see it at anthonysmithjr.com
    There is nothing there for me.
    and then view the gallery. I've just added about 50 new pics
    and don't want to keep the gallery the way it is now - loading
    everything at once. So each section of the gallery will load when
    you go to it - large works and small works.
    The thumbnails are a movie clip within the root movie. Then
    the large version of the pics are another movie clip in the root
    movie. So when your looking at the large work section your seeing
    the main movie (the purple background and buttons) and 2 movie
    clips (thumbnails and largeWorks). I no longer want large works
    movie clip to load when the movie is opened because it takes too
    long. So in a version that I have not put up yet I have the code:
    gotoAndStop(6)
    loadMovie("largeWorks_mc.swf",_root.largeWorksE_mc);
    Ok.. this code will work just fine, but instead of having
    both LoadMovie() and gotoAndStop() on the same frame, it might be
    easier to simply have
    gotoAndStop() on your buttons, THEN, on the frame that it
    goes to and stops, have the loadMovie()
    when you click on the large works tab. This loads the movie
    clip of the large version of the pics and it also take you to frame
    6 or the root timeline (where the large works thumbnail clip is
    located).
    So if you were to do what i suggested, on frame six you would
    also have your LoadMovie() command.
    When I click on a thumbnail in the movie clip
    largeThumbnails_mc in the root movie it should tell the movie clip
    that loaded next to it to go to the frame that contains that the
    large version of that thumbnail.
    yes you would use something like this to target it...
    this. HOLDER . WHAT WAS LOADED . gotoAndStop()
    im using that instead of your instance names because im still
    abit fuzzy on what is loaded and when.
    So I do want to control the only timeline in largeWorks_mc
    (just 50 frames of pics) from the other movie clip in the root
    movie. See the site and see if this is any clearer.
    I really appreciate your help. I'm gutting my bathroom at the
    same time I'm trying to get this thing to work and it's driving me
    insane.
    No problems.
    ________________________________________________

  • Movie clips selecting current target

    Hi
    I am currently stuckon what i think has to be a simple
    problem:) the jist of it is as follows.
    I have a movie clip on stage that is clickable.
    Once clicked I creata new movie clip and attach a movie clip
    from the library.
    At this stage i also create a text field and add it as a
    child to the new movie clip.
    now my problem is that i want the movie clip to be clickable
    so that a user can maniuplate it. However if the click clicks on
    the text field i get an error saying it cant be converted to a
    movie clip. As yes i am casting the selcted object as a movie
    clip:) I just wondered if anyone could point me in the right
    direction of apporaching this, as its drivign me slowly insane.
    regards
    a

    Hi Kglad
    thats a very good question:) and im sure where img oign worng
    but cant work out how to do this:| Belwo is my code that creates
    the new clip once a icon has been clicked on stage.
    function addBubble(event:MouseEvent):void {
    bubbleNum ++; // increment bubble num to use as name of
    bubbles
    // add in bubble clip
    var bubbleClip:MovieClip;
    bubbleClip = new bubble_container()
    bubbleClip.name = "bubble" + bubbleNum;
    port.addChild(bubbleClip);
    // add in text field
    var myText = new TextField(); // initiate my text as
    textfield - CHANGED FROM DOING AS MOVIECLIP AS TEST
    myText.type = TextFieldType.INPUT;
    bubbleClip.addChild(myText); // add mytext to bubbleclip
    myText.text = "wahoo"; // CHANGED FROM >>> attach
    text field form library
    myText.autoSize = "left";
    myText.multiline = true;
    trace(bubbleClip.width);
    bubbleClip.x = 20;
    bubbleClip.y = 200;
    myText.x = 10;
    myText.y = 10;
    myText.width = 218; //bubbleClip.width; // THIS NEEDS
    WORK!!!!!!!!!
    trace("width of text=" + myText.width);
    bubbleClip.addEventListener(MouseEvent.MOUSE_DOWN,
    setSelect)
    steSelect does very little at the minute but it here its is
    for completion.
    function setSelect(event:MouseEvent):void{
    SelectedObject = MovieClip(event.target);
    All i really wnat to acheive is the following.
    user clicks an icon on the stage
    this creates a new bubble movie clip which houses a graphical
    asset(clip pulled from library) and a text field.
    sets up a listerner to see if this has been clicked. (i set
    the current target as selctedObject as there may be multiple
    bubbleClips)
    Once its been clicked it needs to be able to draggable and
    also scalable flippable etc(ive got the code on this working), a
    double click woud result int he text field inside being editable
    (havent got to this buit yet:))
    I jsuit cant get my head around casting and the best way to
    approach this, it works fine if the user clicks on the bbble
    graphic etc.Can u shine any light on this please?

  • Drop and drop 4 movie clips to single target to navigate to seperate urls

    var myTargetName:String = "target" + event.target.name;
    var myTarget:DisplayObject = getChildByName(myTargetName);
    if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget){
        navigateToURL(new URLRequest(http:// websiteAdress.com));
    I am trying to navigate to a new url for each movie clip, problem is im really unsure of how to achieve this I have one target on my page and would like to be able to drop any of these movie clipt o to  it?
    the movie clips are named:
    port1_mc
    port2_mc
    port3_mc
    port_4mc
    really appreciate the help

    assign a property to each movieclip that indicates the associated url.  for example:
    port1_mc.urlS="http://www.adobe.com";port2_mc.urlS="http://www.flash.com";
    port3_mc.urlS="http://www.kglad.com";
    port_4mc.urlS="http:://www.whatever.com";
    you can then use:
    navigateToURL(new URLRequest(e.currentTarget.urlS));
    in your listener function.

  • Target a movie clip inside a movie clip

    When I go to the symbol editing mode on the first movie clip, I drag the instance of my 2nd movie clip to the stage. I then am duplicating my work, (it is over lapping) not sure what I am doing wrong here? and I am finding that my child movie clip is taking on the parent movie clip properties. How do I stop this from happening? I thought they are to remain independent? Any help is greatly appreciated. TY.

    Will the child timeline be independent of the parent timeline. My pend_mc is the child and has taken on the hand_mc properties. Also why is there brackets around some and not the others? Thank you so much for your time.

  • Play internal movie clip at target

    This seems fairly simple, but i can't get it to work.
    I want to play a movieclip from the library when a button is
    clicked. But the LoadMovie is for SWF. The only way I can get it to
    work is have the button click cause - goto frame, which has the
    movie clip. But this gets complicated with various clips. Working
    in Flash 7-8.
    Thank you

    on the last frame of your movieclip attach:
    stop();
    this.dispatchEvent(new Event("finished"));
    right click your movieclip in the library, click linkage, tick export for actionscript and assign a class (eg, Starmove).
    you can then use:
    var minTime:uint = 1000;
    var maxTime:uint = 3000;
    var timer:Timer=new Timer(timeF(),0);
    timer.addEventListener(TimerEvent.TIMER,starF);
    timer.start();
    function starF(e:TimerEvent){
    var star:Starmove=new Starmove();
    addChild(star);
    star.x = Math.floor(Math.random()(stage.stageWidth-star.width));  // these two will probably need adjustment
    star.y = Math.floor(Math.random()(stage.stageHeight-star.height)); // ditto
    star.addEventListener("finished",removeStarF);
    timer.delay = timeF();
    function removeStarF(e:Event){
    removeChild(e.currentTarget);
    e.currentTarget.removeEventListener("finished",removeStarF);
    e.currentTarget=null;
    function timeF():uint{
    return minTime+Math.floor(Math.random()*(maxTime-minTime));

  • Targeting Multiple Movie Clips

    Hi everyone,
    I'm fairly new to ActionScript so I would really appreciate
    any help I can receive.
    Right, I have a Flash file which contains a movie clip with
    an instance called, 'contentHold_mc'. Inside this movie clip are 4
    individual movie clips with instances entitled, 'content1_mc',
    'content2_mc', 'content3_mc' and 'content4_mc'. I know these are
    not the best names for instances, but this is just for simplicty's
    sake. At present all movie clips run at the same time. I want them
    to run sequentially. On the last frame of the instance,
    'content1_mc', I want to stop the instance from playing and start
    playing the instance, 'content2_mc'. On the final frame on
    'content3_mc', I want to stop the instance from playing and start
    playing the instance, 'content3_mc', and so on until 'content4_mc'
    finishes playing. I have tried to use the tellTarget function
    without success and anyway, I believe this is now deprecated.
    Would anybody be able to provide me some guidance please as
    to how I can achieve the previous using the 'dot' notation?
    I have tried the using the code found at the bottom of this
    message in the final frame of the movie clip instance that I want
    to play first ('content1_mc'), however get a compiler error because
    of the preceding two full stops '..'
    Thank you in advance for any help I may receive with this
    query.

    Put a stop(); command at the first frame of each of the
    clips. On the last frame of the first clip put:
    stop();
    _parent.contentHold_mc.content2_mc.play();
    repeat as needed for each movie clip.
    Tell the first clip to play.

  • How do I target a nested Movie Clip in an FLV component?

    Hello all!
    I have a video player that's control bar's x & y are over
    the top of the video. It is set to alpha 0, and when the user rolls
    over the video the control bar's alpha goes to 1 and becomes
    visible. I have a few even listeners and a function that makes this
    happen.
    My issue is that the buffer handle and the volume handle do
    not go to alpha 0, despite the fact that their parents do. The
    instance of "volumeHandle" is the child of "volumeSlider".
    "volumeSlider" does go to alpha 0, then to alpha 1 on rollover, but
    it's child "volumeHandle, is always visible. The same applies to
    the respective instances of the buffer bar.
    I have tried volumeHandle.volumeSlider.alpha = 0; ,but that
    doesn't work.
    My guess is that the conflict lies in the linkage of the
    controls for the buffer and volume handles.
    Any guidance would be greatly appreciated! Thanks in advance.
    Shawn

    Also, the AS I have for the volume bar movie clip, instance
    name "volumeSlider" is:
    stop();
    this.handleLinkageID = "VolumeBarHandle";
    this.handleLeftMargin = 3;
    this.handleRightMargin = 3;
    this.handleY = 11;
    this.fullness_mc.fill_mc.slideReveal = true;
    The VolumeBarHandle linkageID applies to the same MC as the
    "volumeHandle" instance.
    This is one of the two movie clips that will not go to alpha
    0.
    Thanks again.

  • Need help returning correct name from a code created movie clip

    Hello. I am an AS3 n00b with hopefuly a simple question I am designing a simple game in flash. This code creates an array of movie clips and asigns a picture to each one. It is a map screen. What I need is when I click on one of the created movie clips, I need it to return either the index of the clip in the array or the name of the clip. Basicaly anything I can use to tell them apart in the code. Here is the code:
    import flash.display.MovieClip;
    var MapLoader:Array = new Array();
    var strJPGext:String = ".jpg";
    var intContTileNumber:int;
    var strContTilePath:String;
    var intDistStartX:int = 63;
    var intDistStartY:int = 64;
    var intDistMultiplyY:int = 0;
    var intDistMultiplyX:int = 0;
    var intDistCount:int = 0;
    var MapSquare:Array = new Array();
    for (var i:int = 0; i < 729; i++)
             //var MapSquare:MovieClip = new MovieClip();
            MapSquare.push (new MovieClip());
            MapSquare[i].x = intDistStartX + (intDistMultiplyX * 30);
            MapSquare[i].y = intDistStartY + (intDistMultiplyY * 30);
            MapSquare[i].name = "MapSquare" + i ;
            addChild(MapSquare[i]);
            intContTileNumber = i;
            MapLoader.push (new Loader);
            strContTilePath = intContTileNumber + strJPGext;
            MapLoader[i].load(new URLRequest(strContTilePath));
            MapSquare[i].addChild(MapLoader[i]);
            intDistCount++;
            intDistMultiplyX++;
            if (intDistCount > 26){
            intDistCount = 0;
            intDistMultiplyX = 0;
            intDistMultiplyY++;
    stage.addEventListener(MouseEvent.CLICK, reportClick);
    function reportClick(event:MouseEvent):void
        trace("movieClip Instance Name = " + event.target.name);   
    Now all this works fine, it creates the map and assigns the correct picture and places them in the correct X,Y position and it is the correct grid of 27x27 squares. The problem is with the name, when I click on the movie clip, it returns "Instance2" or "Instance5" or whatever. It starts with 2 and then increases each number by 3 for each clip, so the first one is 2, then 5 then 8 and so on. This is no good. I need it to return the name that I assigned it
    . If I put the code in trace(MapSquare[1]) it will return the name "MapSquare1" so I know the name was assigned, but it isnt returning.
    Please assist
    Thanks,
    -red

    Thanks for the resopnse,
    I know I dont really need the name, I just need the index number of the array, but I cant figure out how to get the index name without specificaly coding for it. That is why in the listener event I use event.target.name because I dont know what movie clip is being clicked until it has been clicked on. Basically when a movie clip is clicked it needs to return which index of the array was clicked.
    I could do it this way:
    MapSquare[0].addEventListener(
      MouseEvent.MOUSE_UP,
      function(evt:MouseEvent):void {
        trace("I've been clicked!");
    MapSquare[1].addEventListener(
       MouseEvent.MOUSE_UP,
       function(evt:MouseEvent):void {
         trace("I've been clicked!");
    MapSquare[2].addEventListener(
       MouseEvent.MOUSE_UP,
       function(evt:MouseEvent):void {
         trace("I've been clicked!");
    ... ect
    but that is unreasonable and it kind of defeats the purpose of having the array in the first place. The code that each movie clip executes is the same, eventualy that index will be passed into a database and the data at that primary key will be retrieved and returned to the program. So I just need to know, when one of those buttons is clicked, which one was clicked and what is its index in the array.
    I am a VB programer and in VB this is very easy, the control array automatically sends its own index into the function when one of the buttons is clicked. It seems simple enough, I just dont know how to do it in action script.
    Thanks again,
    -red

  • How can I load an external SWF into a movie clip that's inside other movie clip?

    Hi.
    I creating my first flash (actionscript 3.0) website but I'm
    stuck with a visual effect I want to create.
    I have a window on my website called contentWindow. Every
    time you click a button this window is supposed to leave the stage,
    load the requested content and return to the stage.
    The sliding window is a movie clip with 83 frames, 21 to
    enter the stage, 21 to leave the stage again, 20 for nothing (its
    just to simulate the loading time) and 21 to return to the stage.
    Now my goal is, when the user clicks on a navigation button,
    the window exits the stage, loads an external SWF with the content,
    and then returns to the stage.
    I've the "window" movie clip with an instance name of
    "contentWindow". Inside there is another movie clip with an
    instance name of "contentLoader". The content that the user
    requested should appear inside the "contentLoader".
    Now, when the contentWindow leaves the stage, I get this
    error message:
    quote:
    TypeError: Error #1009: Cannot access a property or method of
    a null object reference.
    at rwd_fla::MainTimeline/trigger()
    If I switch
    "contentWindow.contentLoader.addChild(navLoader);" for
    "contentWindow.addChild(navLoader);" it works fine, but the
    external SWF doesn't move with the window.
    How can I load an external SWF into a movie clip that's
    inside other movie clip?

    Hi,
    Recently, I have been putting together a flash presentation.
    And I am just wondering if the following might help you, in your
    communication with the said swf file:
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    onComplete);
    function onComplete(event:Event):void
    event.target.content.thinggy_mc.y -= 100;
    Not the best example, but this allows you to target a mc
    within an external swf file. I think if you look up this code, you
    will have an answer ;)
    Kind Regards,
    Boxing Boom

  • How do I recerence Movie Clips on the Main Timeline from inside a class?

    Hey everyone, this might be a stupid question but I thought
    I'd ask cause it's making me nuts. I'm all of 2 days into AS3
    (coming from not using Flash at all in YEARS) so feel free to
    consider me ignorant. I do have plenty of application development
    experience in other areas though.
    I can't seem to create a class that can reference an instance
    of a movie clip on my main timeline. I'd post code of what I've
    tried but I've gone through so many desperate edits & wild
    guesses that it was just garbled junk before I deleted it all.
    Basically here's how I figured Flash could work, though maybe
    it doesn't work this way at all.
    I'm assuming that with AS 3 being so big on being a true
    object oriented environment, I wouldn't need to mix my code and
    interface together. Preferably I'd be using the Flash authoring
    tools just to design my interface. Create a button... place it
    somewhere... give it an instance name. Roughly the equivilant of
    Apple's InterfaceBuilder for those of you that might be familiar
    with Cocoa development. I can see maybe having to put a few lines
    of ActionScript onto frame 1 (though really I'm hoping Flash would
    have a better method of kicking off the application at this point
    that using code tied to frames) to load my classes & such, but
    after that I'd like all of my code to be held in external class
    files.
    So maybe I've got:
    Interface.fla - My interface
    Button_1
    Button_2
    TextField_1
    Main.as - My main controller class using to handle all of my
    applications behavior
    SomeClass.as - Some helper Class
    SomeOtherClass.as - Some helper Class
    Main.as would have instructions in its initialization method
    to go ahead & attach events to buttons & initialize
    anything else that needs to happen when the application starts.
    From there on it would all be objects communicating back &
    forth. Button_1 would get clicked with would fire
    Main.someMethod(). Main.someMethod() would then do it's thing and
    set the value of TextField_1. All very clean & code is very
    separated from interface.
    Unfortunately I can't for the life of me figure out how AS3
    classes reference each other like that. There doesn't seem to be
    any kind of a global 'root' or '_root' I can use to locate any
    movie clips on the stage. I've searched the help & the web for
    any kind of simple tutorial but to no avail. My job has tasked me
    with building a flash app for a project but I'd really rather not
    have a tone of ActionScript just shoved into frame 1. That just
    seems... ugh! (::shudder::)
    Can someone maybe point me in the right direction here? I'm
    really willing to do my homework but I can't seem to locate the
    info I need to get started. Also, is there an ActionScript IRC
    channel or something maybe?
    Thanks,
    Cliff

    I worked with the problem last night and the solution I
    started coming to involved creating my own custom document class
    based off which extends MovieClip. My thought is that way I have
    access to the initialization routine of the timeline itself and
    that all of the elements on the main timeline should be
    "properties" of my custom class.
    Is this correct? Is there a down side to doing this & if
    so what is it & why?
    Also, just for my reference, the last time I did anything
    with ActionScript I think I was using '_root' to target the main
    timeline. WHat are the global variable names in AS 3? Is it just
    'root' & 'stage' or 'Root' & 'Stage' or what?

  • Accessing an Array in a duplicated movie clip

    I have a movie clip that has a script declaration of:
    var myCGroup:Array = Array();
    in the first frame.
    (I've also tried var myCGroup:Array; var myCGroup:Array = new
    Array(); and var myCGroup:Array = []; )
    I duplicate this movie clip multiple times. I'm having
    trouble targeting the variable myCGroup from elsewhere in the
    timeline. Other non-array variables that are declared in the same
    place are fully accessible.
    The only code I've been able to write that writes to this
    variable is:
    eval(targetThumb).myCGroup = prodFlush[2].childNodes;
    which actually takes the childnodes and creates an array with
    them.
    However, reading them back out from a separate function later
    is impossible:
    trace("colors to target =====" +
    eval(masterProds[sm]).myCGroup);
    returns nothing. I can read and write to other variables from
    the same function using the same targeting.
    (yes, materProds[sm] == targetThumb)
    Also, the following code results in an undefined array:
    // for(cg=0;cg<cGroupArray.length;cg++){
    eval(targetThumb).myCGroup.push(cGroupArray[cg].firstChild.nodeValue);
    // trace("time: " + cg + " || adding this color group " +
    cGroupArray[cg].firstChild.nodeValue + " to product: "+ targetThumb
    + "===== " + eval(targetThumb).myCGroup)
    Is this a bug, or a documented local vs. global variable
    option that I'm unaware about regarding arrays?
    Any other thoughts? I'm at my wits end.
    Thanks in advance.
    -r

    question[i] =  questionSet.getString(i);Try:
    question[i] =  questionSet.getString(1);Or better still:
    question[i] =  questionSet.getString("QUESTION");or "ANSWER" for the anser record set.
    ResultSet.getString(int) looks up the value in a column (starting at index 1) in a result set.
    getString(String) looks up the value in a column by column name.

  • How do I assign a mouseclick event Listener to a simplebutton already nested in a movie clip when it's dropped on stage?

    I'm trying to assign a mouseclick event listener to a simplebutton nested within a movie clip's later frames, starting at frame 2 and up. This card, however, is not added to my game until later, and when the player clicks on it/turns it over.
    There are four files involved in this program:
    #1 The main actionscript file, which corresponds to
    #2 my dreamQuester .fla file.
    #3 my artifactCard file movieClip's corresponding .as file,
    #4 my combo1.as file corresponding to a an instance of a simpleButton named combo1 that is already
    nested --and this instance is already named-- inside/as a child of said artifactCard movieclip.
    What I've done so far isn't working:
    In my main dreamQuester.as file, when a player clicks on an artifactCard, its MOUSE_DOWN event
    listener takes them to this function (clickArtCard), where the trouble is at:
    // player clicked on the artC card--which is a child of posArt1 on stage--to turn card over:
            function clickArtCard(a_event:MouseEvent) {
                var thisArtCard:artifactCard = (a_event.target as artifactCard);
                thisArtCard.gotoAndStop(unclickedArt1);  // go to frame number of artifact
                                    // card where combo1 button is.
                thisArtCard.removeEventListener(MouseEvent.CLICK,clickArtCard);
                thisArtCard.buttonMode = false;
                trace("combo1.combo is:" + combo1.combo);
                trace("posArt1.artC.combo1 is:" + posArt1.artC.combo1);
                posArt1.artC.combo1.addEventListener(MouseEvent.MOUSE_DOWN, comboClickedWHO);
    when the artC card--the static public instance of artifactCard--is clicked, it only gets to the
    trace("posArt1.artC.combo1 is:" + posArt1.artC.combo1); which returns this error message:  
    TypeError: Error #1010: A term is undefined and has no properties.
        at MethodInfo-61()
    So do how would I declare a static public variable of this simpleButton at the start of my main .as
    file to make it defined to get a mouseDown actionListener into my pre-existing-and-named-instance
    combo1 simpleButton?
    perhaps there is a way, while the debug movie program is running, to click on the simpleButton and see exactly
    what it's parent heirarchy is, to see the name of all parents above the simpleButton incase they are
    different then what I think?
    (just in case, I was hoping to squeeze a zip file containing these files to be less than 9MB incase someone was willing to look at my files to see what I've done so far, but 9 megs is just too big! even though all graphics I've imported where turned into vector graphics with trace bitmap. I wish there was a way to check the file size of each symbol in Flash CS4, here...)
    Thank you so much for any help!
    ~Ethan

    Just use a
    stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
    function keyPressed(event:KeyboardEvent):void {
         //trace(event.keyCode);
         if(event.keyCode == ???){
              // play the sound
    Where I show the "???" you would replace with the keyCode for the key you want pressed for that sound.  To determine the keyCode you can use the trace line that I have commented out.
    Note that when testing in Flash you often need to disable the keyboard shortcuts in the Flash Player in order to be able to use alot of the keys.  You will find this option in the Control menu options in the player.

Maybe you are looking for

  • Attributes Not Working in Smart View

    Hi All, I have an ASO database that has attributes on the Cost Center dimension. In EPMA and in EAS, the attributes are correctly shown. When I pull data in Smart View for a specific cost center, I see data. When I apply the correct attribute, the da

  • DV7 HD upgrade to Seagate SS Hybrid - Will it work?

    I have a failed HD on my DV7t-6100 quad-core. I was looking at purchasing this Seagate Momentus XT 750GB 7200RPM 2.5 inch solid state hybrid drive to replace the factory 750gb HD. I have a few questions about this drive: 1 - Will it be a direct plug-

  • Zen Touch 40gb help/suggestions reques

    Hey guys you have helped me out before so I'm hoping you can come through for me again. I searched for someone with similar problems but couldn't find any good answers. I have not updated the firmware because I was not having too many problems earlie

  • Cannot uninstall InDesign CC 2014 trial version

    I installed the InDesign CC 2014 trial version and now I cannot remove it from my computer. I go to Control Panel/Uninstall Programs and I cannot find it in the list. I looked in the installation folder of the program for some file that allows me to

  • 10.5.6 Update Broke Vista

    I have Vista Ultimate installed on my Macbook White and everything was working wonderfully. Until I installed the Update from Apple today. I booted into Vista and started to get random but frequent freezes rendering Windows completely useless. I had