Note that there are some explanatory texts on larger screens.

plurals
  1. POFlex static variable not working like I need it to
    primarykey
    data
    text
    <p>I've searched and searched and can't find an answer. Actually all the things I've been reading seem to point to the fact that I've done it correctly, but it's just not working.</p> <p>I'm working on a web mapping application. I want to create a SelectionManager class that would be available to all my mxml files (widgets). The point is that I have multiple widgets that will be selecting stuff from the map and instead of sending events back and forth between widgets, I'd rather have one single class that holds all the information.</p> <p>Right now, I've tried something like this :</p> <pre><code>package SomePackage.utils { public class SelectionManager { public static var _selectionSets:ArrayCollection = new ArrayCollection(); public static var _currentSelectionSet:Object; (Many static functions... ex: AddToCurrentSelectionSet, removeFromCurrentSelectionSet, CreateNewSelectionSet, etc.) } } </code></pre> <p>The _selectionSets is an arrayCollection of objects. The _currentSelectionSet holds one of the objects in the _selectionSets arrayCollection. For example, I will have a BufferSelectionSet and a QuerySelectionSet. When I open the Buffer Widget, I want the _currentSelectionSet to hold the appropriate selectionSet from the _selectionSets Array Collection. This way, anytime I click on something when the Bufferwidget is opened, it will be added to the appropriate selection set.</p> <p>Right now, both my widgets import the SelectionManager class but do not instanciate it. What happens is that both my widgets seem to hold a different SelectionManager while I was expecting them to have the same SelectionManager, with the same static vars.</p> <p>For example, if I set the currentSelectionSet from within my Buffer Widget, i will see that it is set to the Object in the ArrayCollection. But if I look at the currentSelectionSet from my Query Widget, it will be null.</p> <p>I'm not sure if i'm being clear enough, I can give more details if necessary. Like I said, I've looked and looked with no success. Furthermore, I'm not a beginner at Flex and AS 3.0 and have quite a bit of experience in other programming language. I'm just completely stumped on this, maybe it's just been a long day.</p> <p>Thanks for any help.</p> <p>Added Information : </p> <p>MY widgets are in a package parallel to the utils package, i.e.: SomePackage.Widgets</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload