Trouble with a simple MVC (of the design pattern)

Below is the troublesome MVC triad (see attached error image). The problem is in the Model where I am loading data from a MySQL database using a php script. The array businessUnits is updated in the constructor. However, in the method getBusinessUnitsList(), it is not.
package
import flash.events.*;
public interface IModel extends IEventDispatcher
  function getBusinessUnitsList( ):Array
  function getBusinessUnit( ):uint
  function setBusinessUnit(index:uint):void
package
   import flash.events.EventDispatcher;
   import flash.net.URLLoader;
   import flash.net.URLRequest;
   import flash.events.Event;
   import flash.net.URLVariables;
   import flash.net.URLRequestMethod;
   import flash.net.URLLoaderDataFormat;
   public class Model extends EventDispatcher implements IModel
  protected var businessUnitsLoader:URLLoader;
  protected var businessUnits:Array;
  protected var chosenBusinessUnit:uint;
  //Constructor
  public function Model()
   businessUnitsLoader = new URLLoader();
   businessUnitsLoader.addEventListener(Event.COMPLETE, onComplete);
   businessUnitsLoader.load(new URLRequest("http://localhost/InteractiveStrategy/businessUnits.php"));
   businessUnitsLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
   function onComplete(event:Event):void
    businessUnits = businessUnitsLoader.data.businessUnits.split("*");
   trace("From constructor "+businessUnits.length)
  public function getBusinessUnitsList():Array
  trace("From method "+businessUnits.length)
   return businessUnits;
  public function getBusinessUnit( ):uint
   return this.chosenBusinessUnit;
  public function setBusinessUnit(index:uint):void
   this.chosenBusinessUnit = index;
   this.update( );
  private function update():void
   dispatchEvent(new Event(Event.CHANGE));
package
import flash.events.Event;
import fl.controls.ComboBox;
public class View extends CompositeView
  private var cb:ComboBox;
  public function View(aModel:IModel,aController:ICompInputHandler= null)
   super(aModel, aController);
   var businessUnits:Array = (model as IModel).getBusinessUnitsList( );
   cb = new ComboBox( );
   for (var i:uint = 0; i < businessUnits.length; i++)
    cb.addItem( { label: businessUnits[i].bem, data:i } );
   update( );
   addChild(cb);
  cb.addEventListener(Event.CHANGE, this.changeHandler);
  override public function update(event:Event = null):void
   cb.selectedIndex = (model as IModel).getBusinessUnit( );
   super.update(event);
  private function changeHandler(event:Event):void
   (controller as ICompInputHandler).compChangeHandler
   (ComboBox(event.target).selectedItem.data);
package
public class Controller implements ICompInputHandler
  private var model:Object;
  public function Controller(aModel:IModel)
   this.model = aModel;
  public function compChangeHandler(index:uint):void
   (model as IModel).setBusinessUnit(index); // update model

I have download the NAVTEQ sample data pack and in the process of importing it, but it seems that using 700mb of data for me to ask oracle "given this point, tell me what country or ocean it is in" would be overkill.
An option would be to load the entire data set, then delete the stuff you don't need (lower level admin boundaries, etc). Of course, at the end of the day it depends on how accurate you want your results to be. The more accurate the data, the more confidence you will have in the result.

Similar Messages

  • I'm having trouble with My adobe Creative Suite 4 Design Standard programs opening. They will bounce to open but won't open up and eventually I will need to force quit as they aren't responding.  I'm thinking it may be a font issue but need some support A

    I'm having trouble with My adobe Creative Suite 4 Design Standard programs opening. They will bounce to open but won't open up and eventually I will need to force quit as they aren't responding.  I'm thinking it may be a font issue but need some support ASAP!

    Nobody can tell you anything without proper system info or other technical details like the crash logs.
    Mylenium

  • I have been having trouble with my iphone 4 for the past day . i tried to update it to 7.0.4 then the screen went blank and it keeps telling me to connect to itunes . I have connected it to 2 computers , using different cords

    I have been having trouble with my iphone 4 for the past day . i tried to update it to 7.0.4 then the screen went blank and it keeps telling me to connect to itunes . I have connected it to 2 computers , using different cords and it doesnt recognize it . It says it is in recovery mode and i need to restore . after clicking restore it says that my iphone cannot be restored . I am very frustrated because i have been online searching for solutions all day and nothing seems to work . As soon as i turn on my phone it goes to the apple logo for about 2 seconds then the connect to itunes screen . SOMEBODY PLEASE HELP ! my phone is my life and i need it back on .

    Connect the device to iTunes and restore from the most current backup.
    If the issue continues, restore as new.

  • Several of us have a iPhone 6s and are having trouble with hearing and speaking at the same time when using the phone. ? The speakers seem to be too far apart? Are others having this issue? Solutions?

    Several of us have a iPhone 6plus and are having trouble with hearing and speaking at the same time when using the phone. ? The speakers seem to be too far apart? Are others having this issue? Solutions?

    Not having the problem, don't personally know anyone who is.

  • I'm having trouble with iTunes synching and accessing the iTunes store.

    I'm having trouble with iTunes synching and accessing the iTunes store.   When synching, the process tops at the back up stage, freezes and I can't close the iTunes window, need to ctrl alt del.   When trying to access the store, the progress bar stops halfway.   I've googled heaps and tried most of the standard answers - unistall, reinstall, etc, now looking for some help please.
    This has only started a few weeks back, after working smoothly for the 2 years of owning the iPhone 3gs.
    Any suggestions will be appreciated, it's getting realy frustrating.
    Cheers for now,
    Marty

    http://support.apple.com/kb/HT1923?viewlocale=en_US
    this worked perfectly for me, with no loss of library! BUT was warned about uninstalling things in the order listed...FYI.

  • I'm Having trouble with OWA and Certs after the Rollup 7 for SP3 installation. any idea? update 2961522-

    Hi, everyone.
    I'm Having trouble with OWA and Certs after the Rollup 7 for SP3 installation. any idea? update 2961522-
    after running get-OWAVirtualDirectory or test-OWAConnectivity i'm getting a message that says "OWA it's Orphan, No Metadata information can be found."
    I only have the OWA users impacted.- anywhere users, and ActiveSync are working well.-
    Thanks,
    Fabian Alberto Campo
    MCT-MCSA 2012-MCITP365-MCTS
    Fabián A. Campo H. Consultor tecnico @ IXO Ltda. MCT MCP MCTS MCSA HP-APS Cra. 67 No. 167 – 61 of 303 Bogotá, Colombia

    Hi Fabian,
    Is there any error code when user access their mailbox on OWA. Please confirm if there is no results returned in EMS when you run Get-OWAVirtualDirectory cmdlet. Also check whether there is any Event Logs related to OWA in Exchange.
    In IIS manager, make sure the OWA virtual directory is listed in the Default Web Site. In EMC, we can navigate to Server Configuration > Client Access, select server and turn to Outlook Web App tab. Then we can click Reset Virtual Directory in the right
    Actions pane to reset OWA virtual directory.
    Additionally, please restart IIS service by running iisreset /noforce from a Command Prompt window.
    Regards,
    Winnie Liang
    TechNet Community Support

  • Has anyone had trouble with dropped calls after downloading the IOS 7

    has anyone had trouble with dropped calls after downloading the IOS 7

    I downloaded mountain lion and then iPhoto '11 in order to tap into iCloud capabilities with all of my devices. (My Mac was outdated in regards to operating platform to do this). After installing iPhoto 11, I had to repair and rebuild my library of photos.  However, after doing this, all of my albums were jumbled and, while I can see the image thumbnail, when I click on the thumbnail, and error that looks like a black triangle and gray exclamation pops up as opposed to the larger hi def image I want to view.

  • Trouble with a bindVar function in the reflection

    Hello everybody!
    I have some trouble with using FXObjectValue.bindVar(...) function.
    I'm getting
    java.lang.UnsupportedOperationException: unimplemented: bindVar
    exceprion :(
    I loked up to source code of JavaFX and I can't find implementation this function, except one that throws this exception.
    Hence I have two questions:
    - Is this function implemented wherever really?
    - If one isn't implemented how can I conquer this trouble or will one be implemented soon?
    //Best regards
    //Alexander

    Hi again!
    I have looked at this classes which you have advised me. Thank you very much!
    But I can't understand what I have to do in the onChange method, when I realise FXChangeListener interface. Any values aren't passed into this method.
    I have tried look up any explanation into source code of the JavaFX compilator, but I haven't found.
    I have some ideas about some solution for this case:
    to save source and destination objects into a class that realises this interface.
    But I don't sure that solution is clear.
    Could you please estimate this idea?
    My be are some other solutions of this problem?
    Thank you in advance!

  • Trouble with playing my podcast since the update of the ipod

    since the update of the ipod that came along with itunes 7, i have been having trouble with playing my podcast as a playlist through my pioneer ipod adaptor system. everything had been working perfectly until this update. i have tried to reset the ipod 3 times but the problem eventually returns. please advise.

    See the link:
    http://discussions.apple.com/message.jspa?messageID=3220507#3220507
    Mac Mini Core Duo 1.66   Mac OS X (10.4.7)   Thinkpad Z60t

  • I`m having trouble with my new advanced system the mac os X 10.0.3

    Hello everybody...
    I need Help, I would appreciated anything anybody could do to help me...
    I`m trying to install the new software the mac os X 10.0.3 and having trouble transfering all my files form the mac os 9.2.2 classic to my new system...Do i have to erase my hard drive to do a clean install???? Could I transfer my files to my home`s computer, instead of buying a portable smartdisk hard drive of 100 Gb, and then so i could transfer my fiels back to my mac without no trouble ????
    I Hope anyone could answer to my post as soon as possible, Thanks

    Hi, John. If you weren't having trouble with Mac OS 10.0.3, it would be a major surprise. OS X 10.0.x and 10.1.x were unusable beta versions and never should have been released, in the view of most people who ever tried to run them. It would be a severe trial of your patience and a waste of your time to install 10.0.3 on your Mac.
    If you want to run OS X, buy OS X 10.2.x (Jaguar), 10.3.x (Panther) or the current version, 10.4 (Tiger). All are available at reasonable prices from AppleRescue. Tiger is also available from any Apple retailer. Carefully read the system requirements for whichever version you prefer, and be sure your computer meets them before buying. If your Powerbook only has a 10GB hard drive, install a larger one (at least 40GB is sensible, since the cost per gigabyte of smaller drives is now exorbitant compared with larger units) before bothering to install OS X.
    It would be most advisable to copy everything on your current hard drive to an external FireWire hard drive, then reformat and erase the internal drive before installing OS X on it. Doing so insures that your data is all safe and that your internal drive is in tip-top condition when the new OS is installed. After performing the installation, you can copy the contents of the external drive back onto the internal drive. The external drive will then be available as backup space for the entire contents of the internal drive, including OS X, all your applications, and all your data.
    While OS 9 is still installed on your hard drive, check to make sure your Powerbook's firmware is up to date. It will need to be brought up to date while running OS 9, before you install OS X 10.2 or higher. Here is the updater for your 500MHz Tibook:
    http://docs.info.apple.com/article.html?artnum=75132
    If the firmware has already been updated, running the updater again will tell you so and will do no harm.

  • Anyone else having trouble with flash player over working the processor since the security update?

    Hi everyone-
    Since the last security update (flash player version 11.7.700.169) I have been having trouble with flash player beating the daylights out of my processor. My OS is Windows XP. This only happens on some sites, not all. For example netflix and amazon are fine, but acorn and huffington post videos send the processor into overdrive. Anyone have any ideas or suggestions? Thanks in advance :-)

    I have XP on some machines, and I do not experience any such problems with 11.7.700.179.  If I were, I would try two things
    update the graphics drivers; see http://forums.adobe.com/thread/945765
    update to the latest Flash Player beta, or wait until the new version is released later this week

  • I am having trouble with billing.  Itunes says the security code on my credit card is invalid but the number is correct.  Please advise.

    I am having trouble with billing.  Itunes store says the security code is invalid but it is correct. Please advise

    You'll need to contact your bank about this my friend.

  • Name of the design pattern

    Hi
    I have been studying a piece of code somebody else wrote. I am wondering if this is the Factory Method design pattern that this represents. I am new to patterns and I would be very thankful for any suggestions.
    public class Creator {
         public Person create(String gender) {
              if (gender.equals(�M�)
                   return new Male();
              else if (gender.equals(�F�)
                   return new Female();
              else
                   return null;
    thanks in advance

    Yes, you are right this is a Factory Method creational design pattern.
    See http://en.wikipedia.org/wiki/Factory_method_pattern for more information.
    Ussualy class which is used to create instances of other classe called XXXFactory and implemented as singleton.
    Regards,
    Yevhen

  • Trouble with a simple transition

    I'm new to actionscript and trying to wrap my head around some simple scripting, but am having trouble.
    My goal in this excercise is to have one symbol/movie clip in frame 1 (stopped on that frame) and then, when clicked, the first cube will dissapear and transition to a different symbol/movie clip in frame 2.
    Here is my script:
    stop();
    stationary1.addEventListener(MouseEvent.CLICK, transition);
    function transition(evt:MouseEvent):void {
        evt.currentTarget.gotoAndStop(2);
        evt.currentTarget.mouseEnabled = false;
    The movie clips I'm working with are just revolving cubes that are different colors. What happens when I run this script is the initial cube is there spinning as intended in frame 1, then when I click it the initial cube freezes and the other cube doesn't show up.

    you probably don't want the evt.currentTarget to advance to frame 2.  that would be the 2nd frame on stationary1's timeline.
    try:
    stop();
    stationary1.addEventListener(MouseEvent.CLICK, transition);
    function transition(evt:MouseEvent):void {
    gotoAndStop(2);

  • Trouble with IE8 placing div in the right spot. Other browsers work fine.

    My layout is working in all browsers (Firefox, Safari, Chrome, Opera, IE6 & 7) but not in IE8 or 9beta.
    The trouble is with a div containing text not displaying below a "lightbox gallery". In IE8 the text div jumps up and appears behind the gallery.
    I've tried using negative pixel definitions in the css (margin-top, margin-bottom) and other simple tricks to no avail. This site is still in development but I do have a few sample pages online. Here's a link to one. http://www.redhousepottery.com/chimerasite/hanks.html
    I have a feeling a css hack is all I need to fix this. I don't have enough practice at this yet. Any help is appreciated!

    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    Add the above to your meta code to emulate 7.0 and probably fix the problem, at least until you can find a fix in IE8.
    Best,
    DR

Maybe you are looking for

  • Photos are not sycning in order to iPhone

    I recently uploaded photos to my iPhone for the first time. I made separate folders with photos in a specific order, and then synced with my phone. Once it was done, I looked up the photos on my iPhone and they were in a completely different order. I

  • Is there a script to create a next page button

    I have a PDF that I need to create next and previous page buttons on. There is no option in the actions menu. Is there a java script I can run to make this happen. I am using Acrobat 9 Pro and I do not know javascript at all. Thanks Tom

  • IE 10 not printing

    My HP Photosmart c309a will not print from Internet Explorer 9 or 10! I can print from google chrome. In IE 10 I keep getting a script error. Windows 7 prints fine. Help!

  • New instances of SAP BO by XML input

    Hi, experts,           Is it possible to input new instances to a Standard SAP BO by using XML input of Service Integration?           I am trying  but still can't figure it out.           If the input is possible, please share me some documentation

  • Default error comes when i Open Opportunity quick create

    Dear all, When i open quick create of opportunity via account. We get an error message. Is there something i am missing in scoping? Error Message : Please enter a party with role Sales Unit. Regards, Dhruvin