custom component - dynamic instances

Hi - I just finished creating a custom component. During development I dragged the component on the stage in the ide and it works fine. However, now I just try to dynamically create example
var newinstance:Mycomponent = new Mycomponent();
I have a problem.
Access to all my methods including disappears the addeventlistener method. Flash moaning that there is no method named addEventListener (...) etc.
If I put my definition of the element in the first frame and method and the stuff of event listener calls in the second frame, then flash is more complaining and I can draw all the properties, etc., but events are not fired.
So it seems there are two problems. I think the first has to do with #initclip stuff in component movieclip. Here I call this.registerClass (...) following the instructions but I have the impression from what I've read that there is something else going on in there to initialize the component when it is created dynamically. The second is something to do with eventdispatching, how did something so simple can take so much time to understand. I must be thick.

Any help would be greatly appreciated.

BTW, I tried using createClassComponent and attachmovie with the same results.

AHA! -J' had the answer. In the layer actions of the first frame of your video component:

#initclip
Import mx.core.UIObject;
Import MillertheGorilla.myComponentsClass;
this.registerClass ("myComponentsClass", myComponentsClass);
This.prototype = new UIObject();
#endinitclip
Stop();

To instantiate a new component during execution:

Import MillertheGorilla.myComponentsClass;

var newcomponent:myComponentsClass = new myComponentsClass();
newcomponent.createClassObject (myComponentsClass, "newcomponent", getNextHighestDepth ());

Tags: Adobe Animate

Similar Questions

  • Is it possible to "build" a custom component using a command line script?

    Hi all

    From time to time to replicate our environment in instances of development/sandbox sandbox, we need the current generation of custom components production.

    What we do in general is - Component Wizard allows you to "build" each component one & then download the ZIPs. \

    I wonder if there is some sort of command line to "build" a custom component?

    That would allow me to write a script to quickly create all my custom components in a go, whenever necessary.

    Kind regards
    Prateek

    To answer the original question, Yes, there is a command line tool to build, activate, deactivate and install the components (even with the preferences), her right here:

    / Data/Oracle/user_projects/Domains/my_domain/UCM/CS/bin/ComponentTool

    Usage: ComponentTool [v |-vv] [t trace_section]--enable |-disable name

    ComponentTool [v |-vv] [t trace_section]... - sync

    ComponentTool [v |-vv] [t trace_section]... [- Install] path.hda: path.zip [-path.hda Preferences]

    ComponentTool [v |-vv] [t trace_section]--check-depends name

    ComponentTool [v |-vv] [t trace_section]... - name of the package

    ComponentTool [v |-vv] [trace_section]...--list-enabled|--list-disabled|--list|--interact|--help t

    The only thing is to compile the Java classes for you. For this you will need to an ANT script or something.

  • Get the name of the custom component

    Hi all

    I have a canvas with a few custom such as components:

    < mx:Canvas id = 'test' width = '100 percent"height ="100% ">
    < custom: Form01 id = "Form01_mxml" visible = "false" x = "0" y = "0" / >

    < custom: Form02 id = "Form02_mxml" visible = "false" x = "0" y = "0" / >

    < custom: Form03 id = "Form03_mxml" visible = "false" x = "0" y = "0" / >

    < custom: Form04 id = "Form04_mxml" visible = "false" x = "0" y = "0" / >

    < / mx:canvas >

    In a menu, I configure the visibility to true to indicate the component I want.

    I would like to know what custom component is visible after a result of an event. Is - is this posible?

    I know I can do multiple if statements to see which element is visible or not as:

    If (Form01_mxml.visible == true) do something

    But I have many components and I would find the dynamic name.

    Thank you

    Johnny

    Instead of visible = "false".

    Use ViewStack

    x="0" y="0">

    var mychoice:Number = 2;

    and slect VS.selectedIndex = mychoice;

    and get the sΘlectionnΘe component as

    VS.selectedChild.id (/ / Form03_mxml)

  • Creation_Complete event not pulling for custom component

    I have a component instantiated in Actionscript:

    var chartControl:ChartControls = new ChartControls();

    chartControl.addEventListener (FlexEvent.CREATION_COMPLETE, initializeChartPanel);

    ChartControls is a VBox that has also a creationComplete method:

    < mx:VBox ' xmlns:mx = ' http://www.Adobe.com/2006/MXML "creationComplete ="init ()">

    public Function init():void {}

    slider.setPanel (chartPanel);

    slider.setThumbValueAt(0,initWid);

    var evt:SliderEvent = new SliderEvent (SliderEvent.CHANGE,false,false, 0, initWid);

    slider.dispatchEvent (evt);

    }

    Could only be originally does not fire?  I've never had a problem for events to trigger, but this is the first time I tried it with a custom component.  How can I get this to work?

    The cause as possible, I do not see where you add the custom component instance:

    this.addChild (chartControl);

    If this post answers your question or assistance, please mark it as such.

  • Custom component... Null object reference

    I'm having a hard time understanding how to solve a problem, I have met in my flex application and I hope someone here can help me out! I will try and provide a very basic example that illustrates my problem...

    <! - Main.mxml - >

    " < = xmlns:mx mx:Application ' http://www.Adobe.com/2006/MXML "layout ="vertical"initialize =" init () "> "

    < mx:Script >
    <! [CDATA]

    private function init (): void {}

    I have a call here that connects to a server of clodfusion by a remote object that returns a user object

    }

    []] >
    < / mx:Script >

    Then, I call a component customized which manages permissions for my application.  I pass on the user object in the custom component

    < user comp: permissions = "{user}" / >

    < / mx:Application >

    <! - Permissions.mxml - >

    " < = xmlns:mx mx:VBox ' http://www.Adobe.com/2006/MXML "creationComplete ="init ()">

    < mx:Script >
    <! [CDATA]

    Basically, this function is triggered and gets some info that depends on the user loged in

    private function init (): void {}

    svc.getSomething (user. PKEY);

    }

    < / mx:Script >

    < / mx:VBox >

    So the problem is that my call to the main application takes a few seconds to run and as the client component is processed before the entire purpose of the use is returned I get the error "object Null Reference '...  How can I make sure that the user object has been created and returned prior to use in my custom components?

    Thank you

    Probably the error will disappear if you create an empty instance of the VO of the user.

  • Getting the list of Custom Component ListView

    Hello

    I'm trying to figure out how to get the 'checked' property of a custom component of QML.

    Basically, it's the same as the first example on https://developer.blackberry.com/cascades/documentation/ui/custom_components/index.html

    This is a list, with a listItemComponents, whose type: "item" contains a check box and the label.

    I have an ActionItem whose job is to take all elements that are enabled and do something.

    The ActionItem triggers a C++ code that should get this list.

    Problem is, I can't figure out how to get the selected items. I tried the selected() function but it returns empty.

    I have to turn this into a multiple selection?

    I got so far is the back of GroupModel, after selection, but this does not include anything other than what I fed in the first place. Which makes sense.

    There are a lot of similarities between this issue and the other. Should help to my code and comments in this post, I think: http://supportforums.blackberry.com/t5/Cascades-Development/LstItemComponent-doesn-t-track-the-model...

  • Create a custom component which scales

    Hi all

    Maybe I can't think good question, but I can't find anything on it.

    I created a custom component extending UIComponent. Inside I have Bitmap, TextField, form. For now the width is fixed.

    Now, I like my element designed to always keep 100% width of the container that I put in it and based on the width would calculate height. I would like to stay same size (ie. not Bitmap scaling), except that we should adapt width of TextField and form - based on the width of the container parent.

    I have to add some listeners for a parent, or override my methods of a component? I'm totally lost here.

    Thank you!

    Michal

    A custom event in the scrolling pane, the configuration container, and the event through your components of bubble.

    i.e. the scrollpane triggers your custom event to the custom container event that triggers the event to your custom components.

  • Alternative to RIDC getResponseStream() in Custom Component

    I am trying to create a custom component that does some work with the primary file and checks in another file. When the replacement file is started, I want to check in the primary file.

    I have found a way to recover the primary file using RIDC, but I'd like to find a way to include this functionality in a custom filter class. Here's a snippet of what I want to reproduce inside the filter:

    ServiceResponse response = idcClient.sendRequest (userContext, binder);

    InputStream fis = response.getResponseStream ();

    OutputStream fos = new FileOutputStream (filename); @

    read of fis, write to fos

    the comparison/work

    My question is mainly to find where the content server provides the input stream for a file that is stored in the database.

    http://www.redstonecontentsolutions.com/technical-blog/Java-filter-retrieving-aFile

    http://www.ecmconsultant.NET/2011/09/UCM-11g-retreiving-rendition-path.html

    Jonathan

    http://jonathanhult.com

  • Question about the use of the custom component class define what declarative component

    12.1.3 jdev

    I'm trying to define a declarative component with my custom component class.

    This is the code for my component jsf declarative. I'm trying to use the label on selectManyListbox attribute to pass queryClass for my component class name. It does not work. I also try to use f: attribute to my component class. It does not work too. Question 1: how to move my declarative component attribute to my class of component?

    < af:panelLabelAndMessage label = "#{attrs.displayLabel}" id = "dc_plam1" > "

    < af:switcher id = "dc_s1" defaultFacet = "a lot" facetName = "#{attrs.single eq 'true'?' unique ': 'a lot'}" >

    < f: facet name = "a lot" >

    < af:selectManyListbox id = "namingp1" simple = "true" label = "#{attrs.queryClass}" "

    ' autoSubmit Binding = "#{dropListComp.selectManyListBox}" = "true" valueChangeListener = "#{dropListComp.selectManyValueChange}" >

    < f: attribute name = "queryClass" value = "#{attrs.queryClass}" / >

    < / af:selectManyListbox >

    < / f: facet >

    < f: facet "single" = name >

    < af:selectOneListbox id = "sl_2" simple = "true" label = "#{attrs.queryClass} '"

    autoSubmit Binding = "#{dropListComp.selectOneListBox}" = "true" valueChangeListener = "#{dropListComp.selectOneValueChange}" > "

    < / af:selectOneListbox >

    < / f: facet >

    < / af:switcher >

    < / af:panelLabelAndMessage >

    That's how I try to retrieve the label or f: attribute queryClass in my component class. I get null for both directions.

    {} public void setSelectManyListBox (RichSelectManyListbox selectManyListBox)
    this.selectManyListBox = selectManyListBox;
    If (this.selectManyListBox.getChildCount () == 0) {}
    queryClass = (String) this.selectManyListBox.getLabel ();
    System.out.println (".. queryClass of the label..." + queryClass);
    If (queryClass is nothing)
    {
    queryClass = (String) this.selectManyListBox.getAttributes () .get ("queryClass");
    System.out.println (".. queryClass of attr..." + queryClass);
    }
    If (queryClass is nothing)
    queryClass = "glog.server.query.powerdata.InvolvedPartyQualQuery";
    this.selectManyListBox.getChildren () .addAll (buildDropListSelectItems (queryClass));
    }
    }

    Thank you.

    Hello

    If your declarative component has a defined class of request attribute then #{attrs.name_of_attribute} called from Java should be able to solve

    Frank

  • Need to include classes in the custom component

    Dear Experts,

    I have created custom components, for custom components, I used some different classes and jars and libs and now I want to include these pots, the lib and classes in the generation of custom component file.

    Please advise me how can I add these files in the component so that when I create the zip file included in the zip file.

    Please send me a link where I can get this information.

    Any help will be really appreciated.

    Kind regards

    Elena

    See the tutorial Services Intradoc

  • Not able to make a checkin to a custom component

    Hi all

    I'm building a custom component which should do a checkin in Webcenter Content.When we are trying to do and test what we get below error every time.

    The error is not so much more descriptive and tried to see if there is any more logs generated in the information system of verification of the Webcenter content but there is no more errors in the Audit log as well.

    Here is the error:

    ! csUnableToCheckIn, (null)! csSecurityGroupNotDefined

    If anyone has faced this problem before, please let us know the solution so that we can fix it immediately, because it becomes a Blocker for us.

    Kind regards
    Elena

    We have solved this problem by e-mail.

    You do not correctly set dSecurityGroup.

    You do this:

    String dSecurityGroup = "";

    serviceBinder.putLocal (dSecurityGroup, "Complaints");

    You must do this:

    serviceBinder.putLocal ("dSecurityGroup", "Complaints");

    The key for putLocal must be the literal string of the name of the metadata field. You will need to change all your other putLocal both method calls.

    Jonathan

    http://jonathanhult.com

  • GET_SEARCH_RESULTS the inside of the custom component

    Greetings,

    I work with a custom component and have led to a question in the process. Basically, inside my component I have references of hyperlink to items in my content server (ex: [! - $wcmUrl ('resource', 'SAMPLE_CONTENT_ID')-].) Now, is in view of the content of an element ID, possible to find this element web site? I scoured all the possible metadata fields and not seen one, but maybe I'm a lack?

    Also, I have some experience with CRMI services available. However, when I try and run these services thanks to a component, my 'validateCheckInData' filter is not able to be executed. I guess that's due to a conflict between types DataBinder. I am able to easily enter the location of a given element web content on my local machine ID by using the code below:

    IdcClientManager Manager = new IdcClientManager();

    IdcClient idcClient = (idc_host) manager.createClient;

    UserContext IdcContext = new IdcContext (idc_user);

    DataBinder binding = idcClient.createBinder ();

    binder.putLocal ("IdcService", "GET_SEARCH_RESULTS");

    binder.putLocal ("QueryText", "dDocName < match >" "+ CONTENTID +"'");

    RequestResponse ServiceResponse = idcClient.sendRequest (userContext, binder);

    DataBinder serverBinder = requestResponse.getResponseAsBinder ();

    DataResultSet dataresultset = serverBinder.getResultSet ("SearchResults");

    DataObject dataobject = dataresultset.getRows () .get (0);

    String url = dataobject.get ('URL');

    If the web site field is not metadata, is it possible for me to run the service GET_SEARCH_RESULTS of my component? The lines above in bold indicate the issues I have with my code by copying and pasting from my local machine to my component code that is executed on the server.

    Thank you!

    > Would you mind critical code in my original post?

    Your code is absolutely horrible, just a joke, I would not dare to criticize the work of others.

    > A million Red flags arose when I had to start my DataBinder object Cast to point to the RIDC jar

    In general, I would not advise to use RIDC leave within a component. CRMI is a client-side technology, while the components (or filters) reside on the server. You use better intradoc API (see http://jonathanhult.com/blog/2012/12/where-are-the-intradoc-java-classes-located/)

  • Using Custom Component error MEssage display

    Hello

    I built the custom component to validate the size of the file and the file Extension.

    That is, user should be able to check in the document if the size is less than 5 MB and the file extension is one of the "png", "tiff", "doc", "Pdf".

    Here, whenever validation files I'm throwing the exception "Type of file file size exceeds the limit or not valid.

    I am able to get the custom component of work according to the validation. And is alsi recording the error in the log file.

    But I need to show the error message when the click the user on the button control on the page of the Complutense University of MADRID.

    From now on, it shows a generic error saying "cannot perform the function validateStandard and service CHECKIN_NEW_SUB.
    The error was caused by a problem generated internally. The error was logged.

    Any help on this is much appreciated.

    Kind regards
    Helen Shetty.

    Hello

    You can throw a ServiceException in your filter with the message you want to display.

    Roman.

  • Impossible to uninstall our custom component.

    Hello

    Version of the Complutense University of MADRID: 11 GR 1 material - 11.1.1.6.0 - idcprod1 - 111219 T 111403 (Build: 7.3.3.183)

    We created a custom component that we tested and it works 100% in the DEV environment, but we cannot even activate, open or remove.

    The component has been downloaded DEV via the advanced Component Manager. We then installed the file generated in the TEST, and

    Here is a list of the warnings, we get:
    1 cannot open a single component of reading"- what happens when you try to open it.
    2. "can not uninstall a component in the Home Directory of the ECM" - this happens when we try to uninstall. We checked into the ECM Home Dir and the component is not listed in there.

    We checked the dir home ECM and the component is not yet there...

    How did this happen to a custom component and how can we overcome this problem or he avoid in the future?

    We must go beyond this issue, please help.

    Thank you

    Yes, he does. That's what I asked earlier on "tags". I don't see that the component tags had file, which is odd - given that tags aren't there, he shouldn't complain. I bet that the file idccs_components.hda in the target system is partially damaged.

    You may need to manually remove the component in the target environment and remove the section in the file "/ucm/cs/data/components/idccs_components.hda"in the target system that designates the component custom. (MAKE A BACKUP OF THIS FILE BEFORE MAKING ANY CHANGES.)

    Open Components Wizard in the dev environment of work (not the web INTERFACE, but the applet), then make sure you generate the component successfully in the development environment. Build it and then take the version rebuilt to import environmental target.

  • Custom component gR 10, 3 of the Complutense University of MADRID

    We have an obligation to build a custom, component in order to change enamel teample for 'Notice of expiry'. From now on, we have a component inside the 'custom' folder called "CS10gR35CoreUpdate" that has the file "query_notification_mail.htm" inside the folder teamplate and many other model. Now I will create a new custom component of the based on the existing "CS10gR35CoreUpdate" and edit the required file 'query_notification_mail.htm' and will allow this component of the Components Wizard and restarts the UCM.

    My Question is: how I'll make sure that new custom component is called when an email is sent for documents to be expired? What abt the existing one?

    Please help me as soon as possible, because I provide the soultion. Thank you!!

    Our custom component is not any file of defination resouce, and I do not see the loadorder in defination of resource. Where can I configure the order of loading on the custom component?

    Yes, that's what I meant (in the .hda folder).

    I have another Q? Is it safe to manually change model "query_notification_mail.htm" who that is on the inside:
    Install dir\custom\CS10gR35CoreUpdate\core\templates\query_notification_mail.htm, I ask this question because I have to make changes only in query_notification_mail.htm, so instead of creating the new component based on exit, if I change the file manually?

    What do you mean by "safe"? Of course, if change you it on a hard drive, it will work (ie. in this particular system, the change will apply). You should be careful when you implementCS10gRXCoreUpdate in the future (a global patch will replace most likely your changes). In general, the change of standard resources is not considered to be a very good practice (quick and dirty), but if it is a change in one system, you can probably live with that.

Maybe you are looking for