Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 15-09-2009
Member
 
Join Date: Oct 2008
Posts: 86
How to access stage elements from within a class

Please let me know how to figure out how to access stage elements from within a class. I enter the following code in my program which does not work by itself..
Code:
tarkey as string

public property let key(byval putData as string)
tarkey=putdata
end property
This is very little code that I have used in Program I have inserted this because I think here is something wrong...
Reply With Quote
  #2  
Old 15-09-2009
Member
 
Join Date: Apr 2008
Posts: 193
Re: How to access stage elements from within a class

You may use the following method this method will be important from all aspects if you wanted to access your elements within the class. You might want to add a constructor or a set function otherwise you will not be able to modify.

Code:
package {
    import flash.display.*;

    public class Main extends StandrdMotionclip{
        public static var mainStage:Stage;
        
        public function Main() {
            mainStage = stage;
        }
    }
}
Reply With Quote
  #3  
Old 15-09-2009
Member
 
Join Date: Nov 2008
Posts: 118
Re: How to access stage elements from within a class

When you view your content in the standalone Flash player, to resize the stage you resize the player itself, The only time I would access a field directly is when the accessor has a lot of overhead. And when you view your content embedded in an HTML page, the stage only resizes when the browser changes the size of the element Flash is embedded into (via Javascript, for instance). another thing to mention is if your looking to retrieve the stage width/height that was used when you published an externally loaded swf.
Reply With Quote
  #4  
Old 15-09-2009
Member
 
Join Date: Dec 2008
Posts: 93
Re: How to access stage elements from within a class

The great part about private variables is that you are able to see all the places they are used when you change something. it is not generally possible to resize the stage from within application logic, unless the container exposes a way to do it. If your getter/setter does something you need, use it. If it doesn't matter you decide. if you do have off stage elements you would need to use a mask so that the mask is the size of your 'virtual' stage.. which can be manually placed .. or drawn by actionscript.. Most browsers do indeed expose such functionality via JavaScript.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to access stage elements from within a class"
Thread Thread Starter Forum Replies Last Post
unable to access western digital elements 1023 External Hard Drive Sereno Hardware Peripherals 8 22-03-2012 10:32 PM
Which stage in TES had the best class creator? Elettra Video Games 6 29-06-2011 10:40 PM
Unable to get a Facebook access using Dell Stage Interface in Dell streak Lotas Portable Devices 5 27-04-2011 03:46 PM
Access the non-public members of the class:C++ UseME Software Development 3 18-01-2010 11:23 AM
Photoshop Elements and Premiere Elements go to version 7.0 Killen Customize Desktop 2 29-08-2008 01:17 PM


All times are GMT +5.5. The time now is 05:07 PM.