Creating a custom component is causing a strange scoping issue

I am a fairly new user to Flash and Actionscript, but I have
a fair amount of experience working with C and Java. I'm currently
working with Actionscript 2 in Macromedia Studio 8. I was trying to
create a new component for a project I am working on, and I
followed the tutorial in the help and all testing works while I am
in context of the flash document where I export the component from.
However, I try testing my component in a new blank document and I
get some strange behavior.
I am able to create a component on the stage, and adjust the
properties perfectly fine. However, when I test the file, the
variables for colors go out of scope. That is, the adjustments I
made to the component through the parameters panel, and saw updated
on the stage aren't demonstrated at runtime. The Number variable I
used however is preserved. I did some traces, and it appears that
this is happening because at runtime in the new blank document, the
variables in the onEnterFrame method go out of scope, where they
weren't before.
It seems really strange to me that I should be able to edit
the color on stage but have it revert while it is running. My
intuition says that if it wasn't going to work in the new document,
that it shouldn't work in either case.
Anyway, here is the code for the .as file, I hope I'm just
doing something stupid.

There seems to be a little confusion here. Think of it this way:
A basic UIComponent by itself is not visible; you can add something you can see to it to make a visual custom component. For example, a ComboBox component is a UIComponent with a ComboBox added to it.
The UIComponent is the lightest weight component available from which you can create other components. I use it as the base for custom components that the user cannot see, like a data manager.
HTH,
Carlos

Similar Messages

  • Creating a custom component in multisim using *.lib and *.olb files

    i have  *.lib and *.olb files for a pspice model. which file i have to you while creating a custom component in multisim.

    Hello,
    Thanks for your question. In order to create simulatable custom components in Multisim you need a SPICE model (Multisim can also understand PSpice Models). The file format for SPICE model can be different according to the manufacturer, for instance: *.cir, *.lib, *.llb. At the end of the day these files are text files that you can open with a text editor, therefore, you can simply copy and paste the model in Multisim.
    Here are two good resources on component creation:
    Component Creation 101
    Creating a Custom Component in NI Multisim
    When you reach the step where you need to enter the SPICE model, simply open the *.lib or *.olb file with a text editor, and copy and paste the model.
    Hope this helps.
    Fernando D.
    National Instruments

  • Creating a custom component

    I am creating a custom component that is based on Canvas.
    I am trying to add this component as a child of another
    component like that:
    myCanvas.addChild(myCustomComponent)
    addChild function expect ObjectDisplay in its argument and
    not a Class. I am little confused. If I am creating a component
    that base on Canvas isnt it inherited from ObjectDisplay?
    please help.

    I actually figure it out. Thank you!!!
    here is what I am trying to do.
    1. creating component_A based on Canvas
    2 in my Application I have Canvas_B
    I wanted to add component_A as a child to Canvas_B
    solution:
    Canvas_B.addChild(new component_A ())

  • Create complex custom component

    Hi everyone!
    I'm trying to create my own custom component in JSF. However I have several questions :
    - It is not mandatory to create a renderer class, right ? the component can draw itself ?
    - How can I create a custom component which would have several "values" inside ? for example let us supppose I want to create a custom JSF component to enter a IBAN. The IBAN is divided into several parts : BBAN, country code, key, Bank adresse,... but any tutorial I've found explain how to create a input component with only one simple value (for example the classical "CreditCardInputComponent").
    Josselin

    Hi,
    did you find a solution for your "composite" component problem?
    I am also trying to create a custom component that contains several standard jsf components such as HtmlCommandLink and HtmlInputText.
    I build all the standard components within my component programmatically using things like:
    HtmlCommandLink link = (HtmlCommandLink) application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
    Also at the beginning of the encodeBegin I clear all children from my custom component using getChildren().clear()
    and rerender the component based on my new internal model which I updated during the previous decoding of my component.
    As a simple jsf custom tag it works ok, however, I am facing deep problems with action events as soon as I use the component within a jsf HtmlDataTable tag.
    Am I missing something here?
    Any ideas? Help is really really appreciated. This different behavior in different contexts is slowly but constantly driving me nuts.
    cheers
    hans

  • Help,Help me!   I want to create  a custom component

    The first, I'm a chinese,my English is very poor.Maybe I make so many mistakes.so
    I say sorry for you.
    I want to create a custom component so I research the Java.awt.Component .but I don't understand that the class has a method-------dispatchEvent(AWTEvent e).I want to know what invoke this method and when invoke?
    thank u

    I believe ( believe mind you )
    that the method:
    public final void dispatchEvent(AWTEvent e)
    Dispatches an event to this component or one of its sub components. Calls processEvent before returning for 1.1-style events which have been enabled for
    the Component.
    Parameters: e - the event
    Is used to send an Event message to This component from another
    like :
    Say you have 'MyComponent1' sending Events to MyComponent2
    AWTEvent e = new AWTEvent( blah whatever.......);
    MyComponent2.dispatchEvent( e );
    and then the Event Handlers on MyComponent2 if any will recieve 'e'
    You Probably don't need to modify this behaviour
    I assume you are doing something like
    public class TestComponent extends Component
    private int MySpecialExtraValue;
      public TestComponent()
         super();  // like : new Component()
         MySpecialValue = 5;  // Just an example
      // Override a Method in Component just as an example.
    public String getName()
       String S = "I am a Custom Component";
        return S;
      //Another override example
      public void repaint()
         System.out.println("repaint() was called");
         super.repaint();  // use the original Component Method
         // blah do own stuff
    }Override any methods that you need to get the required behaviour that you want...
    I hope this is a help........

  • Is  Creating a Custom Component and Custom UIComponent are same in Flex ??

    Hi ,
    I am getting confusion in the terminology of words  with respect to Custom  Components .
    Please let me know whether  Creating a Custom Component and Custom UIComponent are same in Flex ??
    Because i have created some  Custom Components based on Form Container based on my business screens .
    Does they both Custom Component and Custom UIComponent mean the same ??
    Please tell me .
    Thanks in advance

    There seems to be a little confusion here. Think of it this way:
    A basic UIComponent by itself is not visible; you can add something you can see to it to make a visual custom component. For example, a ComboBox component is a UIComponent with a ComboBox added to it.
    The UIComponent is the lightest weight component available from which you can create other components. I use it as the base for custom components that the user cannot see, like a data manager.
    HTH,
    Carlos

  • Help with creating a custom component.

    Hi. I have created a really simple custom component called
    myComp. It is a simple Canvas 100 pixels x 100 pixels with an Image
    control component.
    <mx:Canvas>
    <mx:Image id="image1">
    </mx:Canvas>
    After instantiating the component in Main.mxml eg. var
    pic1:myComp = new myComp(); I am having a problem setting the
    source property of the Image component.
    "image1" is the id of mx:Image in the custom compoenent so I
    tried pic1.image1.source = "assets/ball.jpg" but I get a run time
    error "Error #1009: Cannot access a property or method of a null
    object reference".
    Don't really know what I am doing wrong.
    Any help please!

    In your custom component, try adding a bindable public var
    which contains the path to your image. Also, set the image.source
    to this var.
    In your main app, set the var within the <mx:> tags of
    the custom component. Since it is a public var, it will show up in
    the code hint. You can also now change the image var from the main
    app anytime you like using ActionScript code.

  • How to create a custom component in Integrator

    Hi everybody, I'm trying to develop a custom componente for Endeca Integrator, following this guide:
    http://www.cloveretl.com/blog/creating-your-own-component-in-cloveretl-step-by-step/
    but, even if I installed Plug-in Development Environment (PDE), I can't see plug-in options in File->New->Others section, so I can't follow guide steps.
    Is there any problem with my configuration of Integrator? Why can't I see plug-in development/deployment options anywhere in Integrator?
    Is there eventually another way to implement a custom component in Integrator?
    Thanks for your replies!

    No, it doesn't. It's like PDE has never been installed, but I try to reinstall it through "Help"->"Install new software" I receive an error because the plug-in is installed.

  • How do you create a Custom Component?

    I've made use of a few custom components available on the web
    (IE. a custom fire component from gskinner.com) which made me
    realize I haven't come across any way to make my own components. I
    don't have anything particular in mind at this time, but I can see
    it as an important tool in generating standard re-useable effects.
    Anyone know of the basic process?

    Dear Alberto,
    Check this post.
    Might help.
    PCD content of Netweaver 7.0 available in Netweaver 7.3
    Kind Regards
    /Ricardo Quintas

  • Huge pain Creating a Custom Component with lots of pins

    hello
    I am trying to create an ATmega 128 MCU in multisim that I plan on using to layout a pcb in utiliboard with. SInce this is just for pcb layout purposes I can care less about adding a spice model. I did the "component wizard" and selected "layout only (footprint)" I chose the TQFP-64 package and all is well. I get to step 4 where i "set pin parameters" and this is where I enter the names of the pins. The problem is that this takes a long long time. I thought there has to be some way to import the pin names from a spreadsheet but I couldnt find any way! The only way I can add them is by selecting each cell in excel and copying then going to multisim and selecting the next cell and pasting. I cannot copy and paste a whole column. This would take hours to do for a chip with over 100 pins. The next step "map pins" takes a long time too. I have to individually click between the cells. Is there any way to map everything at once using the same order?
    Also unrelated question. whats the difference between the "TQFP-64" and "TQFP-64L" in multisim? the look identical to me, not sure what the L suffix does.
    Thanks

    Hi smithman,
    It is not possible to import pin names from an excel spreadsheet at this time. I will pass on your concerns to R&D.
    The "TQFP-64" and "TQFP-64L" are quite different if you take a closer look at them. It depends on the manufacturer which one they use for their parts.
    Sorry I could not be of more help.
    Regards,
    Tayyab R,
    National Instruments.

  • Create a Custom Component With Custom Shape

    Hi all,
             I want to create a Component that should have a CustomShape.
             I will explain this in detail ,Suppose now we have a Button, Button will be having some Rectangular Shape, But in my Case i dont want this    Rectangula Shape, I will be giving x and y positons Depending on that positon It has to form a Component.
             Any Help is Greatly Appreciated.

    Even if you use transparent images, you will still end up with a rectangular bounding box.
    You can use programmatic drawing and get a shape that does not involve a rectangle:
    http://livedocs.adobe.com/flex/3/html/help.html?content=skinning_6.html
    http://livedocs.adobe.com/flex/3/html/Drawing_Vector_Graphics_5.html
    http://livedocs.adobe.com/flex/3/html/help.html?content=Drawing_Vector_Graphics_4.html
    If this post answers your question or helps, please mark it as such.

  • Strange Scoping issue

    I've been working on this for hours, and I can't figure it out.
    while (line != null)
    StringTokenizer makeAToken = new StringTokenizer(line);
    int w = Integer.valueOf(makeAToken.nextToken().trim()).intValue();
    int n1 = Integer.valueOf(makeAToken.nextToken().trim()).intValue();
    int n2 = Integer.valueOf(makeAToken.nextToken().trim()).intValue();
    edge newEdge = new edge(w, n1, n2);
    System.out.println(numEdges);
    System.out.println(newEdge.weight);
    addEdge(newEdge);
    System.out.println( ((edge)edges.elementAt(0)).weight);
    numEdges++;
    line = r.readLine();
    heres the code for addEdge.
    public static void addEdge(edge e1)
    edge toAdd = new edge(e1);
    edges.addElement(toAdd);
    So. edge is a class I made, simply having three integer variables, weight, node 1 node 2, and (because of this issue) two constructors, one taking three integers, the other taking another edge.
    What happens is that every element of the Vector edges is a copy of the last thing read in. The System.outs are for debugging, and they should print off an increasing counter (true), a weight for the new element (true), and then the first weight (false), which instead prints out the same thing as new elements weight. If I print out the entire Vector, its the same deal. Multiple elements, but all copies of each other. Please help!

    Would you please include some lines of the file from which you're reading these values, followed by some space, followed by the output you received from running your test case?
    Put them in coded format [code] ..... [/code]
    Thanks

  • Excpeption creating custom component

    Hi all,
    I'm using Sun's RI 1.2 to create a custom component that consist of
    standard components. My problem is that this custom component renders
    ok but when I submit the form that contains it I get an
    IndexOutOfBoundsException.
    Can anyone please tell me what's causing this or what's the problem?
    Here's the exception:
    java.lang.ArrayIndexOutOfBoundsException: 1
         at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1160)
         at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1164)
         at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1164)
         at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:310)
         at com.sun.faces.application.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:300)
         at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:174)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:132)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
         at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
         at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
         at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
         at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
         at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
         at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
         at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
         at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
         at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
         at org.mortbay.jetty.Server.handle(Server.java:313)
         at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
         at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:844)
         at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:644)
         at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
         at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
         at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
         at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
    And here's the custom component code:
    public UIBooleanFieldset() {
    setConverter(new BooleanConverter());
    setRendererType(null);
    Application application = FacesContext.getCurrentInstance().getApplication();
    HtmlSelectOneRadio htmlSelectOneRadio = (HtmlSelectOneRadio)
    application.createComponent(HtmlSelectOneRadio.COMPONENT_TYPE);
    htmlSelectOneRadio.setId(getId() + "_radios");
    ValueBinding radioBinding =
    application.createValueBinding("#{persoonBean.sex}");
    htmlSelectOneRadio.setValueBinding("value", radioBinding);
    htmlSelectOneRadio.setLayout("pageDirection");
    UISelectItems selectItems = (UISelectItems)
    application.createComponent(UISelectItems.COMPONENT_TYPE);
    ValueBinding selectBinding =
    application.createValueBinding("#{persoonBean.sexItems}");
    selectItems.setValueBinding("value", selectBinding);
    htmlSelectOneRadio.getChildren().add(selectItems);
    getChildren().add(htmlSelectOneRadio);
    Thanks for any help!
    regards,
    Jeroen

    Hi,
    I had a little trouble find a maven repository serving the RI jars but eventually I found one:
           <dependency>
             <groupId>javax.faces</groupId>
             <artifactId>jsf-impl</artifactId>
             <version>1.2-b19</version>
           </dependency>
           <dependency>
             <groupId>javax.faces</groupId>
             <artifactId>jsf-api</artifactId>
             <version>1.2_02</version>
           </dependency>By the way, I had this problem with the myfaces 1.2 implementation too.
    Thanks for your help,
    Jeroen

  • How do you reference a valueObject located in main to a custom component created in Catalyst?

    Hello,
    I have been working with the Catalyst Beta 2 / Flash Builder beta trying to create a photogallery and have hit a little bit of a snag, try as I might I can't seem to find the answer anywhere. I am still new to Flex so please excuse me if this is a basic question, I have been trying to understand more about Flex to make my designs in Catalyst better.
    I found this video on Adobe TV: http://tv.adobe.com/watch/rich-internet-applications-101/ria-stepbystep-16-binding-a-data- service-to-flash-builder-components/
    It's wonderful and I have the datalist I created in Catalyst working with the XML file I generated but I designed my little photogallery a bit diffrent, I created a Custom Component in Catalyst so that when you click an item on the DataList it pop's up a little screen with a larger photo in on it, rather then having an image in the main application. Now my problem seems to be that I can't refrence the valueObject I created with the wizard as it's in my Main.mxml file, is there a way to refrence it from my Custom Component so the larger image will display? Is there a way to let the component know which item on the dataList in the main application is selected and display the correct image?
    I should also say I really enjoy working with the Beta for both Flash Builder / Catalyst, thanks for the hard work!
    Thanks for the help,
    Chris

    I am afraid you cannot bind to static properties in Windows Store Apps. It is simply not supported.
    You could create a proxy class that exposes the static command property and bind to this property of an instance of the proxy object:
    http://stackoverflow.com/questions/14186175/bind-to-a-static-field-in-windows-8-xaml
    http://stackoverflow.com/questions/4708711/how-can-i-use-the-xstatic-extension-for-phone7-silverlight-apps
    You will of course have to create an instance of the proxy object. There is no way around this.
    Please remember to mark helpful posts as answer to close your threads and then start a new thread if you have a new question.

  • Advice on creating a tricky custom component

    Hi,
    I'm working on creating a custom component which displays a image at the top of the canvas, and loops through a passed array collection, displaying each row of the array collection in a item renderer. So the component should look like this (see attached image).
    As you can see from this image the header is a image itself, this will differ every instance of the panel, there should be 3 of these panels on the page. Then each row of data is a item renderer displaying the data provided from a array collection of value object. If there are 4 items in this array collection then the panel should show 4 rows, if there are 2 row in the array then the panel will display 2 rows. Also the height of the panel will dynamically change depending on the number of rows to show.
    I was thinking of extending a Canvas component, and then passing in the image URL and trying to load and draw the image dynamically, then I was thinking of using the Drawing API to create the rectangle shape using the drawRoundRectComplex() of the graphics class.
    The problems I see with this is that I don't think the drawn rectangle shape can re-draw itself to show the change in height when more or less row of data need to be be displayed.
    Another option I have been thinking about is extending the Panel class to create my component, this may be better for handling the height resizing, but I'm not sure it can support the look of this component (the header image and the three rounded corners).
    Could anyone give me some advice on what would be the better option for creating this component.
    Thanks
    Stephen

Maybe you are looking for