Stage dimensions(size) in Flash CS4 (AS3)

Hi again,
I need to know how to get the dimensions of my stage (x,y), BUT only the stage and not all the objects that might continue off the stage included.
For example :
     My stage is 400 x 550.
     I want to get 400 and 550 returned.
Thank you for any help and tips!

You can use:
var nW:Number = stage.stageWidth;
var nH:Number = stage.stageHeight;

Similar Messages

  • How can I NOT let collision happen in Flash CS4(AS3)?

    I have been playing with collisions for quite a while, but cannot seem to get it just the way i want it to be.
    I made a new rectangle into a Movie Clip, with an instance name : "block_mc"
    I made a sphere into a Movie Clip, with an instance name : "ball_mc"
    I made the sphere(ball_mc) movable with the arrow keys.(see post:http://forums.adobe.com/thread/491457?tstart=0 )
    Now I wanted to try and make the sphere(ball_mc) stop moving so it wont hit the rectangle(block_mc), so that the rectangle(block_mc) would act like a solid object.
    Meaning the sphere(ball_mc) would not be able to touch the rectangle(block_mc). It would act like a wall.
    Now my problem is I don't know if there is a way of not letting objects collide?
    I tried the ".hitTestObject()" but that did not work for me.
    ~ Thanks for Help and Advice~

    I apologize, for this confusing long question, I simply ment to ask:
    Is there a way Flash CS4(AS3.0) will not let Objects on stage collide?
    ~Thank you for any Tips, Advice and Help~

  • Need help in screen capturing for flash CS4 AS3

    Hi, i need help!!!!!!!!!!!!!!!!!!!!!! URGENT!
    I am currently doing Augmented Reality.
    I got my marker to detect my model but my problem now is how to screen capture the content that is in swf.
    (As in capture the dae model shown in the comp not from webcam.)
    & also i just want to capture the swf window not the whole desktop.
    I read online, they say its impossible?
    Or is it possible to call screen capture function in javascript to flash CS4? (LIke external data)
    (Moreover, does anyone know how to detect multiple dae models with different markers?)
    Anyone can help??? Thanks in adv!!

    My current program (Flash CS4, AS3) only can capture what the webcam sees.
    How do i change it to screen capture (something like print screen) with my .DAE models?
    In the case, when i click on the capture button, it print screen.
    Here's part of the code that capture what the webcam sees.
    private function captureImage(e:MouseEvent):void
       bmd.draw(stage);
       bmp = new Bitmap(bmd);
       bmp.x = 140;
       bmp.y = 40;
       addChild(bmp);
       capture.visible = false;
       saveButton.visible = true;
       discardButton.visible = true;
    Really really need help! URGENT!
    Thanks!

  • (Help) Using Input text in Flash CS4 AS3

    I am trying to take a user's input (His Name) and then greet the user on the next frame using the name he previously entered. I googled for 2days and was unable to find a way to do this on flash CS4 AS3, i guess because im very new to flash (only 2-3weeks )
    Any help would be greatly appreciated, and i am sorry if this was already answered in the forums.
    thanks for reading.

    If your interested... here's some general "rules of the road" that are basically courtesies...
    Don't post the same question in different forums (crossposting).  Folks that help don't like that because they can waste their time providing the same response someone else already offered elsewhere, or their helpful info gets no attention because the OP (original poster) got wrapped up in the discussion elsewhere and never went back to the other forums.  I saw one time where the OP suffered from doing this... the first person to respond in one forum said what they wanted couldn't be done, while my response in another forum showed them how to do it... but they accepted that it couldn't be done and never returned.
    Don't post in someone else's posting unless the exact same situation applies to you and it is a current posting.  It is a bit rude to step into someone else's posting just to get attention, which some people do... some with totally unrelated problems.  Or if your problem is even slightly different, it can end up confusing matters for all involved... trying to juggle helping two people where different solutions are needed.
    If you get one problem resolved and have another you want help with that does not involve the first, start a new posting.  People search these forums so it helps to have topics match the postings, which will not apply if mutliple topics get resolved under one title.  I recently saw one person tell someone to start a new posting even though they were following up to clarify something of the solution they received... that's wrong and is more likely someone with a case of points greed... as useless as points are, it happens.

  • Problem removing Objects from the stage in Flash CS4 (AS3.0)

    I have a problem with this code:
    this.addEventListener(Event.ENTER_FRAME, vanish);
    function vanish(event:Event):void{
         if(character_mc.hitTestObject(vanish_mc)){
              vanish_mc.parent.removeChild(vanish_mc);
    There are two overlapping objects on my stage: character_mc and vanish_mc.
    As soon as i start the scene[Ctrl+Enter] vanish_mc is VISUALLY removed. But the code still sees a collision somehow. How can i Entirely remove the object vanish_mc?
    Thank you for help and advice.

    Ah I think the problem is what my problem not which I proposed, my bad I was trying to keep it simple.
    the remove code in my problem actually looks like this:
    if(character_mc.hitTestObject(this["dollar_mc_"+String(i)])){
         removeChild(this["dollar_mc_"+String(i)]);
    I wanted it to be that way so I could add infinite "dollar_mc_" ' s without writing myself to death with code and or getting confused.
    Imagine it like a game where a character it picking up dollars, which would disappear once they intersect.
    And that exactly is what gives me that argument.
    Do you know a way i could write this code, or do you suggest to leave it that way...because it does run and work im just getting this argument while debugging.
    Thank you for all the help~

  • Flash CS4/AS3 auto-size movieclip box containing TextField

    I have a TextField that I'm going to populate dynamically in code.  Imagine as a simple example a cartoon with the text bubble above the speaker's head, the bubble is a rounded rectangle with some embellishments like drop shadow and a border and such, and I want the bubble to be a fixed width but a variable height to accomodate a few words or maybe a long sentence that wraps to three lines.  I understand that TextField will do this with autosize and wordwrap, but how do I make the 'bubble' movieclip that contains it also resize accordingly, without writing various hacks involving counting the number of characters and resizing the bubble myself?  Thanks!

    assign your bubble a scale9grid and then assign its height based on your textfield's height.

  • Changing color of an object on stage during runtime? in Flash CS4 (AS3)

    Hi,
    I was wondering if there is a way to change the color of an object during runtime. any ideas?
    Thank you for helping.

    you can use the colortransform property of your objects transform property.  so, if you have a displayobject mc, you can use:
    var t:Transform = mc.transform
    var ct:ColorTransform = t.colorTransform;
    ct.color = 0xff0000;
    mc.transform.colorTransform = ct;

  • Right Click Arrange  at runtime in code? in Flash CS4 (AS3)

    Hi,
    I was wondering if and how I can arrange movie clips in AS3 code. I want it to have the same effect as "Right Click > Arrange > Bring To Front" in the project, only during runtime and through code.
    Thank you for help and advice!

    What you can do if you want right click is create a new ContextMenu  and ContextMenuItem. You'll have to add a mouse click listener to each  of your stage items though so you can track the last one clicked;
    import flash.events.ContextMenuEvent;
    import flash.ui.ContextMenu;
    import flash.ui.ContextMenuItem;
    var  lastItem:MovieClip;
    var i:int;
    for(i =  0; i < stage.numChildren; ++i){
          stage.getChildAt(i).addEventListener(MouseEvent.MOUSE_DOWN,  itemClicked);
    function  itemClicked(e:MouseEvent):void
         lastItem =  e.currentTarget as MovieClip;
    var  rightClickMenu:ContextMenu = new ContextMenu();
    rightClickMenu.hideBuiltInItems();
    rightClickMenu.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,  rightClickMenuClicked);
    var bringToFront:ContextMenuItem =  new ContextMenuItem("Bring To Front");
    rightClickMenu.customItems = [bringToFront];
    stage.showDefaultContextMenu  = false;
    stage.contextMenu = rightClickMenu;
    function  rightClickMenuClicked(e:ContextMenuEvent):void
          switch (e.mouseTarget.label)
              case "Bring To  Front":
                   if(lastItem != null){
                         lastItem.parent.addChild(lastItem);           
               break;
    NOTE: You do not need to  first remove the child to add it again. By adding an existing child  you're simply resetting it to the top depth.

  • Getting Information from ID3 tags from streamed mp3 files in Flash CS4 AS3.0

    Hi everyone:
    I have spend my whole day trying to find a good way to access ID3 tags in AS3.0; but didn't find anything helpful.
    In my project I am making a sound object and assigning it a URL:
    Then I stream the sound into a sound channel:
    var s:Sound = new Sound(new URLRequest('URL here"));
    var sc:SoundChannel;
    My problem:
          I want to read the ID3 tag somehow and display the artist name or anything in the ID3 tag, onto the screen.
    Complication:
         I Have the URL change through user input, and naturally I want to update all the information with the new ID3 tags information.
    var s:Sound = new Sound(new URLRequest('NEW URL here"));
    Thank you for any help!

    I know I took it out because it didn't work. I had something like this:
    var soundLoaderContext:SoundLoaderContext = new SoundLoaderContext();
    soundLoaderContext.checkPolicyFile = true;
    var music:Sound = new Sound(new URLRequest("URL #1 (from my server)"));
    var sc:SoundChannel;//sound channel
    var isPlaying:Boolean = false;//checks f music is playing or not
    var pausePoint:Number = 0.00;//this variable is for the pause function
    music.addEventListener(Event.ID3, id3Handler);
    stop_btn.addEventListener(MouseEvent.CLICK, stopMusic);//stop function call
    function stopMusic(e:Event):void//stop function
         if(sc != null)//if music is playing
              sc.stop();//stops the music from playing
              isPlaying = false;//sets it to false(off)
              playPause_mc.gotoAndStop(1);//modifies graphic item on stage
         pausePoint = 0.00;//resets pause value
    play_btn.addEventListener(MouseEvent.CLICK, playMusic);//pause / play function call
    function playMusic(e:Event):void//pause / play function
         if (isPlaying) {// if it is playing
              pausePoint = sc.position;pausePoint get curreny value (position of song)
              sc.stop();//stops the music from playing
              isPlaying = false;//sets it to false(off)
              playPause_mc.gotoAndStop(1);//modifies graphic item on stage
         } else if (!isPlaying){// if it is not playing
              sc = music.play(pausePoint);//starts the music from the pausePoint value.
              isPlaying = true;//sets it to true(on)
              playPause_mc.gotoAndStop(2);//modifies graphic item on stage
    music2_btn.addEventListener(MouseEvent.CLICK, music2);//function call (if music is clicked)
    function music2(e:Event):void{//this function stops current playing music and resets graphics, assigns a new URL and starts playing it.
         if(isPlaying || pausePoint != 0)
              sc.stop();
              playPause_mc.gotoAndStop(1);
         music = new Sound(new URLRequest("URL #2 (from my server)"));
         music.addEventListener(Event.ID3, id3Handler);
         sc = music.play();
         isPlaying = true;
         playPause_mc.gotoAndStop(2);
    music1_btn.addEventListener(MouseEvent.CLICK, music1);
    function music1(e:Event):void{//this function stops current playing music and resets graphics, assigns a new URL and starts playing it. just like above only a different song.
         if(isPlaying || pausePoint != 0)
              sc.stop();
              playPause_mc.gotoAndStop(1);
         music = new Sound(new URLRequest("URL #1 (from my server)"));
         music.addEventListener(Event.ID3, id3Handler);
         sc = music.play();
         isPlaying = true;
         playPause_mc.gotoAndStop(2);
    function id3Handler(evt:Event):void {
          var id3:ID3Info = evt.target.id3;
          trace(id3.artist + ' - ' + id3.songName);
          name_txt = id3.songName;
          album_txt = id3.album;
          artist_txt = id3.artist;
    This is mostly just taking the exact code from the website I mentioned earlier.
    When I run this it outputs the trace command 1 time and nothing more. Only the trace(trace(id3.artist + ' - ' + id3.songName);) gets triggered once.
    No errors. No warning. Not working.
    Thank you for helping me!

  • Is it possible to change fps during runtime? in Flash CS4 (AS3)

    hi,
    I was wondering if there is a way to change fps(Frames Per Second) during run time using AS3.
    is there? if so is it recommended? or is there a way to slow down the execution of the code(like adding a pause?)
    Thank you for attributing anything related!

    You can use the stage.frameRate property to eadr or set the fps rate during run time.  The only way to really pause code from executing is to build the paused code into a function and delay calling that function using some form of a timer (like setTimeout).

  • General Question About common Instance Names in Flash CS4 (AS3)

    I tried something interesting recently. I had code effecting an object with the instance name : object_mc.
    Now I added another object and gave it the same instance name.
    The result was, that the code only effected the most recent added object (no error).
    Is there a way in flash to have multiple objects with the same instance name all being affected by one piece of code?
    ~ Thanks for any thoughts, advice or facts. ~

    Advice: avoid it... if you want to control different instances, give them different instance names.
    It depends on what you mean by "one piece of code".  Directly using the instance name to target the movieclips will work as you have seen already... Last one added gets the attention.
    To use the instance name to take action is doable more along the lines of testing each movie to see if it has the name, but still, you would have to target each using a different means. 
    For the piece of code below I have some number of objects on the stage and I test to see if they have an instance name assigned (object_mc) that is shared by some of them, and I am able to move them if they do, but I cannot use the instance name to target each of them for action... in this case I use the getChildAt method.
    for(var i=0; i<this.numChildren; i++){
    if(this.getChildAt(i).name == "object_mc"){
      this.getChildAt(i).x += 200;
      object_mc.x += 25;  // only moves the last object added

  • Make a Fake Mp3 Player in Flash CS4(AS3)

    Hi,
    I am trying to Pause and Play A song.
    Details:
    I made a new project.
    --> File > Import > Import to Library > (choose mp3 song)
    Drag mp3 song from Library to stage.
    Press (Ctrl+Enter)
    The result is that the song plays.
    My question is:
    Is there code to make the music "Pause" and "Play". Is there a way to directly influence the playing file?
    Anything helps
    ~Thanks

    Is it possible.
    Here's a link to a tutorial on how create this
    DISCLAIMER: This an intermediate to advance level so it will take sometime to understand
    http://flashspeaksactionscript.com/create-a-mini-music-player-in-as3/
    HTH

  • Flash CS4/AS3 - How to use a preloader with FLVs?

    Somehow I've had a really hard time finding a straightforward forum answer or tutorial for this--maybe someone can help?
    I have an SWF file that references/loads an external FLV file (www.44designs.com/promo_video.php), but since the FLV file is about 9MB and can take time to load on a slower connection, I think a preloader (something simple like "LOADING...100%") would be a good idea as the FLV loads.
    Anyone have a simple way to do this??  I've had no success in finding what I need--just scripts for loading SWFs.  You can see an example of this on www.44designs.com where a preloader script I've got seems to be referencing the SWF (thus loading almost immediately) instead of the much larger external FLV.  Make sense?  I'm not super AS3 savvy, but I can follow logic and cut and paste

    Great info, thanks for the post!

  • How can I execute certain code once the button on stake is hit at runtime? (in Flash CS4(AS3))

    Hi
    I am trying to figure out how to execute code once a button_btn is hit on stage at runtime.
    Thank you for help and tips!

    You can also try to create an event listener for the button itself.  (In as2.0 it was onClick or onPress or something to that effect, now I'm not sure what they are syntaxed as but there are event listeners for buttons which "listen" to see if the button has been pressed.  Mouse Events are good because it makes sure that the mouse is actually performing the action.  Don't know about accessibility with Mouse Events though since you can use a Tab key to direct input of buttons so try the Button event listeners.

  • Make an object vanish in Flash CS4 (AS3.0)

    I have a question on how i can remove an object when two objects hit.
    I have two objects on the stage overlapping.
    object #1 = character_mc
    object #2 = vanish_mc
    I want to make it so that the object #2 (vanish_mc) will vanish once i run it.
    I have this code:
    this.addEventListener(Event.ENTER_FRAME, vanish);
    function vanish(event:Event):void{
         if(character_mc.hitTestObject(vanish_mc)){
              // here the code to remove vanish_mc from the stage
    ~ Thank you for help and advice ~

    you can always use:
    vanish_mc.parent.removeChild(vanish_mc);
    to remove vanish_mc from the display list.
    but, you'll need to stop all streams in vanish_mc, if there are any.  and, if you're not going to use vanish_mc anymore, you should ready it for gc.

Maybe you are looking for