Constructor not invoked

Ask a Question related to Macromedia Flash, Design and Development.

  1. #1

    Default Constructor not invoked

    I've created a class in ActionScript called OptionsPanel. It's
    intended as a pop-up with some checkbox items on it.

    In my code I invoke this as follows

    this.attachMovie ("optionsPanel", "options_mc", 1);

    and sure enough the panel appears. But... the panel appears only
    as it has been created in the authoring environment. That is the
    static components appear, but any attempt to add dynamic content
    isn't happening. In particular the constructor doesn't appear to be
    executed, and stranger still a trace of the options_mc doesn't show
    any of the defined methods, or any fields added in the constructor.

    I have other classes that work as expected, including a second
    options panel which has only dynamic content added in the constructor.

    This is weird because the requested movie *is* being displayed, but
    it's as if the constructor and any other defined methods are
    inaccessible. I have a "traceObject" method on _root that can be used
    to examine objects. After the movie has been attached this fails to
    show any of the functions of the class, or any properties that should
    have been added in the constructor.

    The panel class contains a CheckBox and a ComboBox. Both have
    change handlers that get called okay. The movie consists of three
    layers, and I found the change handlers had to be placed in
    the same layer as the controls. The majority of the script is
    in a dedicated "scripts" layer.

    I read elsewhere it might be a naming issue, so I tried to rename
    the panel with no success... besides, the panel is being invoked,
    I just don't have access to it's methods (and hence) it's
    dynamic data.

    Could the placing of script in multiple layers be the problem?

    Any help/pointers would be appreciated.

    --
    John A Fotheringham ("Jaf")
    Purple turtles living in sin, doo dah, doo dah
    John A Fotheringham Guest

  2. Similar Questions and Discussions

    1. #39457 [NEW]: Multiple invoked OO connections never close
      From: josh at mykoala dot com Operating system: OS X 10.4.8 PHP version: 5.2.0 PHP Bug Type: MySQLi related Bug description:...
    2. Command Event in button being magically invoked.
      Top of page: Listbox and button. Listbox contains a list of products. Button says "Load". Beneath both is a datagrid. In the datagrid, 25 columns...
    3. How to stop the webservice once invoked
      Hi, I'm consuming my own webservice through a web page by using a button. So on button click my web service gets invoked and does a defined...
    4. Calling SUPER::constructor in the constructor
      Is it possible to call the constructor that a function inherits from its parent? I tried calling SUPER:: and SUPER-> in a constructor and got...
    5. Getting the name of an invoked method?
      Hello, In the C Ruby API, is there a clean way to get the name of the method which has been invoked? ie. If there is a single C function...
  3. #2

    Default Re: Constructor not invoked

    >Could the placing of script in multiple layers be the problem?

    Okay, I'm answering my own question here. This was indeed the
    problem. I removed the controls and change handler routines
    from the "controls" layer and placed both into the "scripts"
    layer. Having done that, the Constructor was called, and
    I could see methods and dynamic data as expected.

    Subsequent tests showed that only the script code needs to be
    moved... you can leave the controls on a separate layer.

    So placing some change handler code in a different layer seems to
    have managed to "hide" all the class code placed in a different
    layer (all this on frame 1).

    Is this a bug or by design? If by design, can someone please
    explain it to me.

    This may relate to another problem I've been having, namely that
    any components I add in the authoring environment statically
    don't expose their methods (such as setValue etc), and refuse
    to match all sensible "instanceof" tests. The only cure for
    that I've found is to create all component objects dynamically
    in the constructor, which is a little painful.

    --
    John A Fotheringham (Jaf)
    Convert text files to HTML or RTF in seconds
    [url]http://www.jafsoft.com/products/index.html[/url]
    John A Fotheringham Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139