2 Replies Latest reply on Oct 30, 2006 3:36 PM by Newsgroup_User

    createClassObject not working on my component

    Level 7
      I have created a component called Mediablock and I have initialized it
      so that I can use the createClassObject method with it:

      static var symbolName:String = "Mediablock";
      static var symbolOwner:Object = Mediablock;
      var className:String = "Mediablock";

      This does not work - it returns undefined.

      import flashblocks.*
      mc = this.createClassObject(Flashblocks,"media1",6);
      trace("createClassObject: "+mc)

      But yet the object exists: trace(Mediablock) and the component works
      fine if I drag an instance on to the stage.

      Here is a clue. createClassObject WILL WORK if I drag a Flash component,
      like the Button, into the library as well. But if I delete the Button
      component, my Mediablock component will not work anymore.

      Any ideas. I have tried converting to compiled clip first and still nothing.

      If anyone has any ideas please let me know

      Thanks,

      --
      Sunny

        • 1. Re: createClassObject not working on my component
          Level 7
          On the other hand if I drag an instance of the component onto the stage,
          I can createClassObject inside of the component like this:

          mc = eb.createClassObject(Editblock, "eb1", 50);
          trace("createClassObject: "+mc) // returns new instance eb1
          trace(eb.createClassObject) // [type Function]

          I still can not create an instance elsewhere.

          mc = createClassObject(Editblock, "eb1", 50);
          trace("createClassObject: "+mc) // This returns undefined

          Sunny




          Sunny wrote:
          > I have created a component called Mediablock and I have initialized it
          > so that I can use the createClassObject method with it:
          >
          > static var symbolName:String = "Mediablock";
          > static var symbolOwner:Object = Mediablock;
          > var className:String = "Mediablock";
          >
          > This does not work - it returns undefined.
          >
          > import flashblocks.*
          > mc = this.createClassObject(Flashblocks,"media1",6);
          > trace("createClassObject: "+mc)
          >
          > But yet the object exists: trace(Mediablock) and the component works
          > fine if I drag an instance on to the stage.
          >
          > Here is a clue. createClassObject WILL WORK if I drag a Flash component,
          > like the Button, into the library as well. But if I delete the Button
          > component, my Mediablock component will not work anymore.
          >
          > Any ideas. I have tried converting to compiled clip first and still
          > nothing.
          >
          > If anyone has any ideas please let me know
          >
          > Thanks,
          >
          • 2. Re: createClassObject not working on my component
            Level 7
            Here is the solution...

            I needed to drag a copy of the UIObject MC into my 2nd frame assets of
            my component.

            Just importing the UIObject is not enough.

            Maybe this will help someone else out.

            Sunny

            FLASH CONTENT MANAGEMENT | http://www.flashblocks.com



            Sunny wrote:
            > On the other hand if I drag an instance of the component onto the stage,
            > I can createClassObject inside of the component like this:
            >
            > mc = eb.createClassObject(Editblock, "eb1", 50);
            > trace("createClassObject: "+mc) // returns new instance eb1
            > trace(eb.createClassObject) // [type Function]
            >
            > I still can not create an instance elsewhere.
            >
            > mc = createClassObject(Editblock, "eb1", 50);
            > trace("createClassObject: "+mc) // This returns undefined
            >
            > Sunny
            >
            >
            >
            >
            > Sunny wrote:
            >> I have created a component called Mediablock and I have initialized it
            >> so that I can use the createClassObject method with it:
            >>
            >> static var symbolName:String = "Mediablock";
            >> static var symbolOwner:Object = Mediablock;
            >> var className:String = "Mediablock";
            >>
            >> This does not work - it returns undefined.
            >>
            >> import flashblocks.*
            >> mc = this.createClassObject(Flashblocks,"media1",6);
            >> trace("createClassObject: "+mc)
            >>
            >> But yet the object exists: trace(Mediablock) and the component works
            >> fine if I drag an instance on to the stage.
            >>
            >> Here is a clue. createClassObject WILL WORK if I drag a Flash
            >> component, like the Button, into the library as well. But if I delete
            >> the Button component, my Mediablock component will not work anymore.
            >>
            >> Any ideas. I have tried converting to compiled clip first and still
            >> nothing.
            >>
            >> If anyone has any ideas please let me know
            >>
            >> Thanks,
            >>