Public static var - quick question

Gidday

Slowly converting my calendar code AIR dekstop app to OOP, and I'm at the part where I am loading in the user settings in a SQL table.

I was wondering, is a public static var one good thing to use for holding user settings?

I thought I had a class UserSettings user settings that may be held to get and set as they are needed or changed.

Click Save, I can just walk them and save them in SQL.

And all my classes can access them if necessary.

Or is there a better way?

See you soon

Be more specific on what is YipeeClass and what he really needs. YippeeClass probably doesn't have access to all settings variables.

For example, if YippeeClass is a point of view, he's probably just things it is designed to show. Provide you (getters/setters) properties on the view and then your main class for the Document (or better yet, a controller class dedicated) looked at the settings and fill in the properties of the display according to relevant parameters. Don't worry the Document class on how these parameters affect the view - it will be now responsible for displaying to translate the properties in any way (for example, to set the text of a text field). This is known as Dependency Injection.

If the user interacts with the view in a way that impact parameters, send you an event to the view which is intercepted by a controller or the main document class and that class then will bring the necessary changes to the settings.

Classes should always know the strict minimum necessary to accomplish all that they are directly responsible, and each class should be responsible for something.  I suggest you get the book associated with the links I posted: Actionscript 3 Design Patterns. At least she would give you a framework to think about such things.

Tags: Adobe Animate

Similar Questions

  • public static const even as public static var

    Is it the same thing to use

    public static const

    as

    public static var

    technically, no.

    a const value cannot be changed.  value of var can be changed.

  • PhoneListener cannot access a public static vars initialized in the main thread

    Using the emulator (SDK 4.7, phone model 9500)

    I have a class PhoneListener defined and recorded, he gets the phone events without any problems. It's all public static public var that is initialized in the main thread is always null when it is examined in the context of the PhoneListener callback thread, when examined in the main thread or a son they are defined.

    I guess since the PhoneListener callbacks are called from a system thread, it cannot access the battery of my request - it seems correct? is this in any way about this?

    I tried Application.getApplication () .invokeLater (...), but validated all executable from the PhoneListener recalled suffers from the same problem.

    Thanks - Lindsay

    Exactly, that's what I was wondering - I found the answer according to the PhoneListener in the MIDlet . Now I store my UiApplication object in the running store and access them from the PhoneLister to publish objects on my main application via invokeLater.

    Thank you

    Lindsay

  • Two quick questions (hopefully) - right way to dynamically change the CSS class and put of Splash screen implemented

    Couple of quick questions have left me speechless!

    So, it seems obvious that many JavaFX applications want to dynamically change the CSS styles.  Is the best way to do it through la.getStyleClass () .add ("classname") < node >?  The underlying data structure is a list of observable.  So let's say we have 5 styles that simply to change the fill color of a circle of 5 different colors, respectively.  So if I have a condition in which I want to dynamically apply 1 of these 5 styles, as I do now it's by setting all 5 styles as a string in a list by using a static initializer, then I call < node > .getStyleClass () .removeAll (list), then getStyleClass () .add ("classname").  I do this to avoid adding again and still the same style and inflate the underlying list.  What is the right way to manage dynamic CSS styles?

    Finally a very simple I think.  So I know there's a little differently to implement a splash screen.  My app has certainly got bigger in the last few months of development and I noticed there are about a 5 second delay between when I run the application when I see the main stage.  I was thinking what a splash screen would be nice to fill that time.  I had no time to prototype using a Preloader and I fear that using another, early stage start-up again would be too long of a delay.  "I actually thought that using the Nice and simple JVM argument" - splash: image name > "would be simple, easy and effective.  Unfortunately when I try to do, the splash screen appears but never goes away.  Anyone know what is happening with this?

    Your mechanism to manage the css style classes is a good approach; I've used several times. I wonder why the style classes have been implemented as a list, instead of a game, but there may be cases of good use for the use of a list.

    In some cases you can also consider using CSS PsuedoClasses, which were presented in JavaFX 8. Here is a little easier to use, especially if you have two options. But a use case might look like:

    public class Message {
        public enum Status { NORMAL, WARNING, CRITICAL }
    
        private final ObjectProperty status = new SimpleObjectProperty<>(Status.NORMAL);
        private final StringProperty message = new SimpleStringProperty();
    
        // constructor, getters, setters, and property accessors....
    }
    
    public Label createLabel(Message message) {
        PseudoClass warning = PseudoClass.getPseudoClass("warning");
        PseudoClass critical = PseudoClass.getPseudoClass("critical");
    
        Label label = new Label();
        label.textProperty().bind(message.messageProperty());
        message.statusProperty().addListener((obs, oldStatus, newStatus) -> {
            label.pseudoClassStateChanged(warning, newStatus == Message.Status.WARNING);
            label.pseudoClassStateChanged(critical, newStatus == Message.Status.CRITICAL);
        }
        return label ;
    }
    

    And then your css looks like

    .label:warning {
        -fx-text-fill: orange ;
    }
    .label:critical {
        -fx-text-fill: red ;
    }
    
  • Airport Extreme - static IP configuration question

    Question: AT & T has us on a range of public static IP address xx.xx.xxx.33 - 38 (six addresses). I already put in place with the gateway, subnet. But I need the Airport Extreme to provide more than just 6 addresses to support all of our devices. Is this possible and if yes, how I have set up?

    Attempted solutions: I tried to expand the DHCP range manually in the settings of the utility. I changed it to 10.0.214.33 - 38 (which was the default range) to 10.0.214.30 - 39 to see if this helped more devices, but she did not.

    Help, please! Our business leaders are coming and I need to have this resolved.

    Thank you

    -bo

    The key is that Apple routers are designed for general public use. They don't have many options when it comes to commercial applications. You better get a router that provides these additional features. I recommend that you consider the research in routers of professional level provided by Cisco (or similar) for this purpose.

    None of the available options, provided by AirPort Extreme, will be able to satisfy your needs network entirely.

    For example, you can use the network > router Mode to 'DHCP' option only This would use a public ISP IP addresses for the base station and to distribute the five for customers... other required network, but you will not be able to use this setting to distribute IP addresses private network customers remaining, as this option disables the service NAT on the base station.

    Will on the other hand, using the NAT and DHCP option would take care to provide for the remaining machines, private addresses but allow only one device is accessible with a public IP address by placing the appliance in a DMZ. Apple calls this a "default host".

  • {} Public static

    Boy, it is difficult in 53 and feeling totally stupid, but Java can do it for me.

    I; have my head wrapped around statics and constants and static methods, and I found (thankfully) one of the examples which allowed me to analyze step by step to better understahnd the language (it's my best course).

    However, it baffles me: things wrapped in JUST {} public static.  I've been Googling like crazy, but all the explanations are either variables or class, not fopr this thing.

    Here is an example of the MemoryDemo example I discuss:

    // Statics -------------------------------------------------------------------------------------
    private static Random _random;  To generate random numbers for dates and channels.
    private static ubyte [] _letters; To generate random strings.
       
    // Constants -----------------------------------------------------------------------------------
    private static final int MIN_STRING_LENGTH = 3;   Minimum length for a random string.
    private static final int MAX_STRING_LENGTH = 10;  Maximum length of random string.
       
    public static
    {
    _random = new Random();
    _letters = new ubyte [MAX_STRING_LENGTH];
    }

    So, I understand not statements made by the statics and constants... no problemo.

    But what is the reasoning behind the encapsulating the _random and _letters inside the {} public static?  Is it just a kind of shorthand for something else?

    Again, I apologize for what must seem like stupid question, but I don't want to jump on something that I think moight be crucial to understand.  Thanks in advance (again)!

    -John

    I don't see why initialization that you see in this class could not be done as you suggest.

    However, there are other situations where this isn't the case.

    For example not elegant and simple (there are other better ways to dong that), you can have a static value that identifies whether the device is a touch screen,

    If you have

    public static boolean IS_TOUCH_SCREEN;

    public as well as any other class can test this just by using .IS_TOUCH_SCREEN

    {public static

    String pattern = DeviceInfo.getDeviceName ();

    If [(model.startsWith("95"))

    IS_TOUCH_SCREEN = true;

    } else {}

    IS_TOUCH_SCREEN = false;

    }

  • Public static political static NAT in conflict with NAT VPN

    I have a situation where I need to create a VPN site-to site between an ASA 5505 using IOS 7.2 and a Sonicwall NSA4500. The problem arises where the LAN behind the Cisco ASA has the same subnet an existing VPN currently created on the Sonicwall. Since the Sonicwall cannot have two VPN both run on the same subnet, the solution is to use policy NAT on the SAA as well as for the Sonicwall, the new VPN seems to have a different subnet.

    The current subnet behind the ASA is 192.168.10.0/24 (The Sonicwall already has a private network virtual created for another customer with the same subnet). I try to translate it to 192.168.24.0/24. The peer LAN (behind the Sonicwall) is 10.159.0.0/24. The ASA relevant configuration is:

    interface Vlan1

    IP 192.168.10.1 255.255.255.0

    access extensive list ip 192.168.24.0 outside_1_cryptomap allow 255.255.255.0 10.159.0.0 255.255.255.0

    list of access VPN extended permit ip 192.168.10.0 255.255.255.0 10.159.0.0 255.255.255.0

    public static 192.168.24.0 (inside, outside) - list of VPN access

    card crypto outside_map 1 match address outside_1_cryptomap

    In addition, there are other static NAT instructions and their associated ACLs that allow certain traffic through the firewall on the server, for example:

    public static tcp (indoor, outdoor) interface smtp SERVER smtp netmask 255.255.255.255

    The problem is this: when I enter the static strategy statement NAT, I get the message ' WARNING: real-address conflict with existing static "and then it refers to each of the static NAT statements reflecting the external address to the server. I've thought about it, and it seemed to me that the problem was that policy NAT statement must be the first statement of NAT (it is the last one) so that it is run first and all traffic destined to the VPN to the Sonicwall (destination 10.159.0.0/24) tunnel would be properly treated. If I left him as the last statement, then the other static NAT statements would prevent a part of the 10.159.0.0/24 network-bound traffic to be correctly routed through the VPN.

    So, I tried first to my stated policy NAT upward in the ASDM GUI interface. However, moving the declaration was not allowed. Then I tried to delete the five static NAT statements that point to the server (an example is above) and then recreate them, hoping that would then move up the policy statement NAT. This also failed.

    What Miss me?

    Hello

    I assumed that we could have changed the order of the 'static' , the original orders, but as it did not work for some reason any then it seems to me that you suggested or change, that I proposed should work.

    I guess that your purpose was to set up static political PAT for the VPN for some these services, then static PAT of public network access, then static NAT to policy for the rest of the network in-house.

    I guess you could choose any way seems best for you.

    Let me know if get you it working. I always find it strange that the original configuration did not work.

    Remember to mark a reply as the answer if it answered your question.

    Feel free to ask more if necessary

    -Jouni

  • Help on parameters public static function

    Hello

    I have two functions in the same file, how can I use the first function as a default value in the second function.

    public static function get decimalFormatter1 (): {NumberFormatter

    //

    }

    I have try this:

    public static void secondFunction(param1:String,_param2:Int=0,_ _param3:Function=decimalFormatter1_):Array {}

    //

    }

    Error:-1047: unknown parameter initializer or isn't a compilation constant.

    Any ideas?

    Thank you!

    To work around the problem, you can use null as default, where null means "use the decimalFormatter1. You have to write something like

    public static void secondFunction(param1:String,_param2:int_=_0,_param3:Function_=_null):Array
    {

    trainer: function var = null;

    If (param3 is nothing)

    Formatter = decimalFormatter1;

    ....

    }

  • Help with public static functions.

    Hey everyone, I worked on a problem for a while and have finally understood just wrong. Google is not helped me to find the right way, so I'm posting it here. I sort of understand what's wrong with my code, but I have no idea how to do right. I'm a total noob to AS3, this is my first project.

    I have a main FLA file called game.fla with nothing on the stage, starting with. The document class is Main.as (shown below). The main class is supposed to manage the switching between the preLoader, mainMenu and game itself. The preloader loads and the player must press play to go to the main menu. The main menu is controlled by MainMenu.as, which adds event listeners for buttons game, instructions and credits. At the present time, instructions and credits just draw responses. When you click on play, I want to remove the mainmenu (not a problem with parent.removeChild (this)); and add the game. This is my problem comes in. I can't say parent.addChild (game), because honestly, I don't know how (I need to set a variable in hand or MainMenu and must it be public, static, etc?). Simplicity seems to be a function called initializeGame() that I could simply call of mainMenu. Problem: I have to do a static function, which doesn't let me use addChild, removeChild or any other variable that I create. Could someone please explain how I could do this job (even if it means change my structure. "I would be happy to learn a better way to deal with this kind of thing). Also, on a side note: if I can't use the static function with add or remove a child, can I optimize the effect later? I want later in my game, that I would need to call functions between classes, on a button click, for example, that affect the scene (or objects in the scene). Can I do it another way? For example, by clicking on an icon of the video game card clip, I would map the movieclip to load. A function that could be described seems the best way to do it, but I'm sure he can otherwise. Thank you much in advance. My code is below.

    Main.As

    package
    {
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.events.MouseEvent;
    
        public class Main extends MovieClip
        {
            private var preLoader:PreLoader;
            private var mainMenu:MainMenu;
            private var game:Game;
            
            public function Main()
            {
                preLoader = new PreLoader;
                addChild(preLoader);
                preLoader.gotoAndStop(1);
                addEventListener(Event.ENTER_FRAME, barLoading);
            }
            private function barLoading(event:Event):void
            {
                var total:Number = stage.loaderInfo.bytesTotal;
                var loaded:Number = stage.loaderInfo.bytesLoaded;
                preLoader.loadingBar.scaleX = loaded/total;
                
                if (loaded==total)
                {
                    removeEventListener(Event.ENTER_FRAME, barLoading);
                    preLoader.gotoAndStop(2);
                    preLoader.doneLoading.addEventListener(MouseEvent.CLICK, doneLoading);
                    loaded = null;
                    total = null;
                }
            }
            private function doneLoading(event:MouseEvent):void
            {
                preLoader.doneLoading.removeEventListener(MouseEvent.CLICK, doneLoading);
                mainMenu = new MainMenu;
                addChild(mainMenu);
                removeChild(preLoader);
            }
            static public function initializeGame():void
            {
                game = new Game;
                removeChild(mainMenu);
                addChild(game);
            }
        }
    }
    

    MainMenu.as

    package
    {
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.events.MouseEvent;
    
        public class MainMenu extends MovieClip
        {
            
            public function MainMenu()
            {
                playGameButton.addEventListener(MouseEvent.CLICK, playGameButtonFunction);
                instructionsButton.addEventListener(MouseEvent.CLICK, instructionsButtonFunction);
                creditsButton.addEventListener(MouseEvent.CLICK, creditsButtonFunction);
            }
            private function playGameButtonFunction(event:MouseEvent):void
            {
                playGameButton.removeEventListener(MouseEvent.CLICK, playGameButtonFunction);
                instructionsButton.removeEventListener(MouseEvent.CLICK, instructionsButtonFunction);
                creditsButton.removeEventListener(MouseEvent.CLICK, creditsButtonFunction);
                            
            }
            private function instructionsButtonFunction(event:MouseEvent):void
            {
                instructionsButton.removeEventListener(MouseEvent.CLICK, instructionsButtonFunction);
                trace("instructions");
            }
            private function creditsButtonFunction(event:MouseEvent):void
            {
                creditsButton.removeEventListener(MouseEvent.CLICK, creditsButtonFunction);
                trace("credits");
            }
        }
    }
    

    In addition, anny comments on my coding habits and how to improve are welcome.

    in the hand

    var preloader: Preloader = new Preloader (();)

    preloader.addEventListener ("preloadCompleted", preloadCompletedF);

    in the Preloader, loading complete:

    this.dispatchEvent (new Event ("preloadCompleted"));

  • public static void

    Hello

    I have a public static void passing the name of my datagrid as string.

    public static function myFunction(myDG:String):Void
       
    {
            var myDG_length =
    this[myDG].dataProvider.source.length;

        }


    How can I do this [myDG] work here?

    I have try without luck:. dataProvider.source.length (myDG as DataGrid)

    Thank you

    Well maybe

    myFunction(this["whatever"]);

  • Just a quick question about the appearance of the cluster

    Hello, this is Matthew, just a quick question about the appearance of the cluster

    Is there anyway to rearrange the order of the elements? I know cutting automatic resizing, I could move the items by hand. But if I use the cluster somewhere else, I have to move the items again...

    What I want is of the order of "Mx My Mz Ax Ay Az Temp voltage CS".

    Is there a quicker way to deal with?

    THz so much!

    You can right-click the border of the cluster and choose "arrange control cluster...". "The user interface is not as intuitive as it could be, but it will allow you to reorder items. If you use the cluster in several places, you should make the cluster in a type definition and replace all current uses of the latter with the type definition, so that they all match. They will also update automatically when you make changes to the type definition. Otherwise, you could have a situation where you have multiple groups with the same data types, but with elements in a different order, and your data will be getting a new denominated, when wire you the whole clusters. The data will be in the same order, but given that the item labels are in a different order, you can't get the data you want, when ungroup you by name.

  • public static nat/global vs

    Excluding an access list, what is the difference between:

    NAT (inside) 1 172.16.5.10 net 255.255.255.255

    192.168.5.10 (outside) 1 global net 255.255.255.255

    and

    static (inside, outside) 1 192.168.5.10 172.16.5.10 net 255.255.255.255

    Thank you.

    in static reality must be combined with the access list for a two-way communication... You are right in a sense that

    public static nat/global access-list =

    Basically, the rule is that the traffic is allowed more high to low infterface of default security

    BUT

    from the lowest to the highest security of communication you need an access as well as the STATIC list

    Thank you

    Nadeem

  • public static problem (inside, outside)

    I use a PIX to isolate a subnet to a corporate network.

    inside is the corporate network

    outside is not approved LAN

    A single user in LAN not approved need to go to a specific set of IP addresses in

    And all other users can browse the Internet via downstream

    proxy server to talk to the corporate proxy server

    It works fine,

    Why I can't use the static suite for this

    public static 159.182.111.0 (Interior, exterior) 159.182.111.0 netmask 255.255.255.255 0 0

    problem is that I have to continue to add each ip address static statement such as

    public static 159.182.111.50 (Interior, exterior) 159.182.111.50 netmask 255.255.255.255 0 0

    public static 159.182.111.60 (Interior, exterior) 159.182.111.60 netmask 255.255.255.255 0 0

    public static 159.182.111.70 (Interior, exterior) 159.182.111.70 netmask 255.255.255.255 0 0

    public static 159.182.111.80 (Interior, exterior) 159.182.111.80 netmask 255.255.255.255 0 0

    Unfortunately this site VIEW use different IP addresses in the subnet, everyday

    Is any limitation of this ststic command at the low security access

    interface high security by using the static command

    Hi, I don't know, but the problem may be in the netmask in your static instruction,

    It must be 255.255.255.0 or so because it is a network and not a host.

    hope this helps.

  • Quick question on installing RUEI, RUEI 12 c Release 4 (12.1.0.5)


    Hi people,

    I have started the installation procedure, downloaded RUEI 12 c Release 4 (12.1.0.5).

    I had a quick question.

    I decided using the following installation option:

    Installation and configuration, journalist and collector of component on the same server (Red Hat
    Enterprise Linux 5)

    Use the distance journalist Oracle db, GR 11, 2 on a separate server (Suse 11, x 86-64)

    This configuration should work, the Oracle db running on Suse 11, but the RUEI
    components are run on RHEL 5?

    Thank you

    Ashish

    Hi Ashish, this should be no problem at all. In fact, it is a common facility.

  • Am about to buy DW.  2 quick questions before proceeding.  (1) can I associate a DW created an EXTERNAL SQL Express database for the read/write site?  Can be made safe?  (2) am plans to use Contribute to allow non-technical users to end dry change

    Am about to buy DW.  2 quick questions before proceeding.  (1) can I associate a DW created an EXTERNAL SQL Express database for the read/write site?  Can be made safe?  (2) am plans to use Contribute to allow non-technical end users EASILY change the sections of the web site.  Can this work?  Thank you.

    I would like some ideas.

    A CMS is the standard solution in the industry today. The most common environment is LAMP (LINUX, Apache, MySQL, PHP).

    Some of us to write custom CMS systems for a living. I concentrate on CMS for retirement centers. There are all kinds of solutions CMS available ranging from generalist, off-the-shelf CMS like WordPress, completely custom, with a lot of opportunities in the meantime.

Maybe you are looking for

  • possible to bring slide them to unlock iphone?

    Since the update, you can drag to unlock the iphone. It is extremely annoying that this gesture had become a second nature after many years. is it possible to swipe to reopen the iphone - maybe a setting I don't know?

  • Key feature missing from system preferences option

    Instructions for Apple supports page says: "Click the Apple menu in the upper left corner of the screen, and select System Preferences. Click on the keyboard icon, then check the box marked "use all F1, F2, keys as standard function keys etc. BUT...

  • Firefox find other websites than the opera or Explorer

    By the site www.upc.nl/pakketten get this basic information is 39,50 euro and for the first 6 months euro 27,50.Exploren and Opera have on the site of the upc, only 39,50 euro price.Now I have a talk with the upc.How is that possible?

  • Cannot turn off option "sleep and fresh."

    I can't turn off the option "sleep" and fresh. I did not need, and it disrupts the functioning of my scanner. Apparently, we should have two types of USB ports: with the sign 'Flash' (used for the options 'sleep... ") and normal. I have on the left s

  • Satellite of swapping screen LCD L850-150 to another with more resolution?

    Hello I am owner of a Toshiba L850-150, with a screen resolution of 1366 x 768 and I want to know if it is possible to change the Lcd display to another with more resolution, say a panel that is capable of displaying a resolution of full HD 1920 * 10