Call the new method? (simple question)

Once the summary of the product label is in charge, I would call my setLabel method to set the value of the text of the label. This should be easy, but the parameters of the method are cases "e: Event" I was not able to do 'setLabel()' or ' setLabel (e: Event) "and addEventListener is not working either. HELP PLEASE!

public function drawProductSummaryLabel() : void
  {
        // Create a holder that will contain the footer label.
        var productInfoHolder : Sprite = new Sprite();
       // Add the holder to the stage.
        addChild(productInfoHolder);   
   
   //Create font for the label
   var format1 : TextFormat = new TextFormat();
         format1.font = "DejaVu Sans";
    format1.color = 0x000000;
    format1.size = 12;
    format1.bold = true;
   
   productSummaryLabel.visible = true;
//   productSummaryLabel.defaultTextFormat = format; // WHY DOES THIS NOT WORK???
   productSummaryLabel.autoSize = TextFieldAutoSize.LEFT;
   productSummaryLabel.wordWrap = true;
   productSummaryLabel.selectable = true;
   productSummaryLabel.alwaysShowSelection = true;
   productSummaryLabel.width = 846;
   productSummaryLabel.height = 80;
   productSummaryLabel.text = "loading text"; // Initial text before its replaced
   addChild(productSummaryLabel);
   
   trace("Step 9: Product text appears now.");
   
   // Add xml data in label
   productSummaryLabel.addEventListener(Event.COMPLETE, setLabel); // THIS HAS NO EFFECT!!
   
   // Create the button
   var button : Sprite = new Sprite();
    
    // Disable the mouse events of all the objects within the button.
         button.mouseChildren = false;
         // Make the sprite behave as a button.
         button.buttonMode = true;
 
    // Create an original state for the button.
         var originalState : Sprite = new Sprite();
   originalState.graphics.beginFill(0xFFFFFF);
   // Follows format of: x, y, width, height
   originalState.graphics.drawRect(0, 0, 846, 80); // Apparently roundRect is possible!!!
   originalState.alpha = 0.5;
         originalState.name = "original";
         // Create a hovering state for the button. 
         var hover : Sprite = new Sprite();
   hover.graphics.beginFill(0xCCCCCC);
   hover.graphics.drawRect(0, 0, 846, 80);
   hover.name = "hover";
         // Add the states to the button as well as the label.
         button.addChild(originalState);
         button.addChild(hover);
         button.addChild(productSummaryLabel);    
         // Position the text to the center of the box
         productSummaryLabel.x = (button.height/2) - (productSummaryLabel.height/2); // footerLabel.x = button.x for left align.
         productSummaryLabel.y = (button.height/2) - (productSummaryLabel.height/2); // Center align looks better than left align!
   
         // Add mouse events to the button.
         button.addEventListener(MouseEvent.MOUSE_OVER, displayMouseOverState);
         button.addEventListener(MouseEvent.MOUSE_OUT, displayMouseOutState);
         button.addEventListener(MouseEvent.CLICK, displayMessage);
   
   // Add the button to the holder.
         productInfoHolder.addChild(button);
   
   // Postion The Menu.
        productInfoHolder.x = 80;
        productInfoHolder.y = 275;
   
   // Hide the over state of the button.
         hover.alpha = 0;
  }    
   
  
  private function setLabel(e : Event) : void
  {   
   // FOR EACH statement to say a summary should appear for each object once it is in the center
   // first start with simpler statement saying if no data then load
   trace("Set label value");

   for (var i: int = 0; i < numOfProducts; i++) // change this so it corresponds to necessary summary // Done in product info label i think
          {

    var myLoader : Loader = new Loader();
    var myRequest : URLRequest = new URLRequest(uebersicht[i]);
    myLoader.load(myRequest);
    
    var myNewText : String = e.target.loader as String; // or e.target.content.loader

    productSummaryLabel.text = myNewText;
  }
(...)
  }

> This should be easy, but the parameters of the method are "e: Event" I was not able to do 'setLabel()' or ' setLabel (e: Event).

If you want to call a method without going to the event - add a null default value to the parameter as follows:

private void setLabel(e:Event_=_null):void

Then you can just make setLabel() and the compiler won't complain. And you can't do setLabel(e:Event) for a call, that makes no sense. You would need to make a new event to happen: setLabel (new Event ("someEventString")) but unless you have a specific reason to pass the event, the method is easier.

Tags: Adobe Animate

Similar Questions

  • Call the new method? (error: no response)

    Hello

    I just posted a message asking how to call a method of the constructor that has parameters e: Event. I checked by mistake this post as answered when in reality it is not. I was told I might add = null in the parameter of the function to make it work like this:

    public function ProductSummaryLabel() : void
      { 
       drawProductSummaryLabel();
       setLabel();
      }
    
    private function setLabel(e : Event = null) : void
      {
       var summaryLoader : Loader = new Loader();
       var summaryRequest : URLRequest = new URLRequest(uebersicht[0]);
       summaryRequest = new URLRequest(uebersicht[0]); // index
       summaryRequest.contentType = "text";
       summaryRequest.method = URLRequestMethod.GET;
    
    
      
        // Try to load the desired summary, if not possible then handle errors
        try 
        {
         summaryLoader.load(summaryRequest);
        } catch (error: ArgumentError) {
         trace("An Argument Error has occurred.");
        } catch (error: SecurityError) {
         trace("A Security Error has occurred.");
        } catch (error: Error) { 
         trace("An Error has occurred.");
        }
        
       myNewSummary = new String (e.target.data); // THIS THEN TARGETS A NULL OBJECT
       productSummaryLabel.text = myNewSummary;
        }
    

    The problem with this is that the line myNewSummary = new String (e.target.data) then no longer works. How can I solve this problem?

    As I answered in your other post, if you assign the defautl as a null value when you use the 'e', you need to check for null

    That is to say.

    If (null! = e)

    {

    myNewSummary = new String (e.target.data);

    }

    on the other

    {

    myNewSummary = "DEFAULT STRING";

    }

  • What is the new method of SQL joins

    Dear all,

    What is the new method of SQL joins

    1

    SELECT <fields>
      FROM TableA a INNER JOIN TableB b ON a.key = b.key
    

    2

    SELECT <fields>
      FROM TableA a, TableB b
     WHERE a.key = b.key
    

    Above the two queries work very well in PL/SQL, but request that no 1 does not work in Oracle Forms 10 g

    Kind regards

    Zafar Iqbal

    Hello

    Zafar Iqbal wrote:

    Dear all,

    What is the new method of SQL joins

    1

    1. SELECT
    2. TableA, TableB INNER JOIN a and b WE a.key, b.key =

    2

    1. SELECT
    2. FROM TableA, TableB b
    3. WHERE a.key, b.key =

    Above the two queries work very well in PL/SQL, but request that no 1 does not work in Oracle Forms 10 g

    Kind regards

    Zafar Iqbal

    What, exactly, is your question?

    Literally ask you which of these 2 methods is new?  As mentioned above, none is really new.  Both participated in Oracle at least 13 years.

    Query 1, above, ANSI join syntax uses, which is more recent.   As mentioned above, Oracle has started to support that the syntax in version 9.1 (2001) previous versions only supported syntax used in query 2.

    Did you mean to ask something else?  Maybe "How can I use a query as a query 1 forms?" or "are there other places where a method works, but the other is not?

  • What is the best way to call the Java method in JSP in weblogic 10.3

    Hello

    What is the best way to call the Java method in JSP in weblogic 10.3?

    Thank you for your help in advance.

    Thank you
    Manu

    Hello Manu,

    If I understand your question, all you need to do is import the Java class you want to create / obtain an instance of it (if you're not calling a static method), then call the method, the entire interior of the JSP. It works the same way in Weblogic that it works in any JSP.

    Kevin

  • BrowserField IllegalStateException to call the RequestContent method

    Hello world.

    I'm IllegalStateException when you try to view another page HTML on my BrowserField. This happens when BrowserField Manager calls the removeField() method.

    The paper said: to remove is field with focus - index: 0 - fieldDebugTree: net.rim.device.api.ui.component.NullField (0, 0) + (0, 0) * home * \n - managerDebugTree: net.rim.device.api.browser.field2.BrowserField (0, 0) + (480, 70) [480, 70] \n net.rim.device.api.ui.component.NullField (0, 0) + (0, 0) \n

    Everyone knows that kind of problem before?

    Thanks before.

    Never mind. I found the solution to this problem after doing some more research on this forum.

    Here is the link to the post with the solution: http://supportforums.blackberry.com/t5/Java-Development/BrowserField-refresh-throwing-IllegalStateEx...

  • Call the java method lunch application

    Hello

    I use JDev 12.1.3 with MAF, I want to call the java method of the project ViewController lunch application, how can I do this?

    Thank you

    Hello

    Can you explain usecase? What features do you need perform the start-up of the application?

    You can run java code in an application LifeCycleListener - https://docs.oracle.com/middleware/maf210/mobile/develop-maf/maf-apps-register-listeners.htm#ADFMF25120

  • Connector WFD SDK - how to call the server method?

    I use the FMS connector C++ to perform editing work. And I am obliged to call a method side server.

    I tried to use the INetConnection::call () method, but it seems to be successful.


    The specification of the server FMS told me to do,

    1. call the server method,

    NC. Call (streamname, null, "FCPublish");


    2. implement a callback function onFCPublsih

    nc.onFCPublish = function (info) {...}

    How can I implement the latter with FMS Connector C++?

    The FMS connector document include a subject too little on the method call server-side.

    WFD SDK connector, the netconnection call prototype looks like this.

    virtual bool call (const char * funcName, const unsigned char * arguments, unsigned size, OnResultHandler * result) = 0;

    Thus, you will have to serialize the arguments and then pass it to call the function.

    Check

    bool FMSCTester::testCall (const char * cmd, const char * arg)

    method in FMSCTester sample application that comes with the software development kit how to serialize and call the function.

    For Server callbacks, you have to implement a netconnection sink with the onCommand method is called when the server calls a method on the client.

    The onCommand prototype looks like this,

    onCommand Sub (const char * cmd, const unsigned char * arguments, unsigned bufLen, IRetValue * retVal)

    again, you can check the MyNCSink class in the FMSCTester sample project for an implementation of onCommand.

  • Passing variables to Flash,... using the new method

    This is the method I used (note the '? ') pageLoad = $pageLoad"):

    < object classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase =' http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7, 0,19,0' width = '150' height = '710' >
    < param name = "movie" value =' images/menuSys.swf ? pageLoad = $pageLoad' / >
    < param name = "quality" value = "high" / >
    < embed src =' images/menuSys.swf ? $pageLoad = pageLoad' quality = "high" pluginspage = " http://www.macromedia.com/go/getflashplayer' type =" application/x-shockwave-flash"width ="150"height = '710' > < / embed >"
    < / object >

    -----------------------

    After the new method that corrects the ActiveX thing in Internet Explorer, I am now using this method:

    integrate flash animation
    AC_FL_RunContent)
    'codebase', ' http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8, 0,0,0',
    'width', '150'.
    'height', '710',
    'src', ' images/menuSys ? $pageLoad = pageLoad',.
    'quality', 'high ',.
    "pluginspage", ' http://www.macromedia.com/go/getflashplayer ", "
    "align", "middle",
    'play', 'true ',.
    'loop', 'true ',.
    "scale", "showall"
    'wmode', 'window ',.
    "devicefont", "false."
    'id', 'home',
    'bgcolor', '#ececec ',.
    'name', ' images/menuSys ? $pageLoad = pageLoad',.
    'menu', 'true ',.
    "allowScriptAccess", "sameDomain",.
    "a movie", "images/menuSys ? pageLoad = $pageLoad',.
    "salign", "
    ); end AC code

    -----------------------

    The problem I have is that the $pageLoad variable is passed is no longer. I use PHP to have a variable passed in the src string. Anyone have any ideas? I guess that PHP does not like to pass something to this embed method because it is located in an area commented <!-->... .but I am not sure. I even tried to use this method, ' images/menuSys ? pageLoad = <? $pageLoad? > '. It does not either. How to get us to the dynamic variables, passed through embed tags now?

    slam the neck... DUH!

    I forgot to 'echo '.

  • Noob question: call the new Menu screen

    Hello.

    I have two screens. The first is called myScreen and is defined in a class file called plotter.java. It works very well. It has a menu that also works.

    What I want to do is to launch a new screen called windshield which is defined in windscreen.java. I tried to do it with the following menu item code, but it does not compile because it does not recognize the windScreen() method:

    private MenuItem menuWind = new MenuItem("Set Wind", 1, 1)
    {
        public void run(){
            pushScreen(windScreen());
        }
    };
    

    What I am doing wrong?

    P.S. My apologies for the basicness of this issue, you can tell I'm new to the Java/BlackBerry development.

    Try this,

    Windshield wn = new windScreen();

    UiApplication () .getUiApplication () .pushscreen (wn);

    This will help u.

    ------------------------------------------------------------------------------------

    Kudo press to say thank you to the developer.
    Also, press accept it as a button when you got the Solution.

  • How can I transfer my data from Microsoft Money 2001 to a newer version? What we call the new version?

    I UNDERSTAND THAT MICROSOFT MONEY VERSI0N 2011 IS DECOMMISSIONED. I AM HAPPYTO UPGRADE TO A NEWER VERSION, BUT A QUESTION AS TO HOW I CAN TRANSFER ALL DATA ON MSM 2001 TO THE NEW VERSION. WHAT WOUKLD NEW VERSION BE CALLED

    original title: MISROSOFT MONEY VERSION2001
    original title: How can I transfer my data from Microsoft Money 2001 to a newer version?

    Hello

    Check in the Microsoft Money Forum.

    Microsoft Money - Forum
    http://social.Microsoft.com/forums/en/money/threads

    Microsoft Money Solution Center - suggests alternatives
    http://support.Microsoft.com/mny

    What is Microsoft Money Plus sunset
    http://support.Microsoft.com/kb/2118008

    BING - microsoft money replacement
    http://www.bing.com/search?q=Microsoft+Money+replacement&go=&QS=n&SK=&SC=7-27&form=QBLH

    Google - microsoft money replacement
    http://www.google.com/#sclient=psy-ab&hl=en&source=hp&q=microsoft+money+replacement&pbx=1&oq=microsoft+money+replacement&aq=f&aqi=g4&aql=&gs_sm=e&gs_upl=9978l11972l2l12926l12l1l0l0l0l0l467l467l4-1l1l0&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=dcc84c4c7dd2e143&biw=1024&bih=681

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • reference not valid error 1026 to the runVI call the hand method exe-&gt; slot - VI-&gt; secondary

    Hello

    I have a main VI who Subvi inside case structures put in place to show FP when called and be modal.

    These subVIs have a secondary that will pull up a call using RunVI method dynamicVI. The dymaicVIs is built using the constant application directory + name of VI to the invoke method.

    now the main VI is built in exe with the dynamicVIs in the list always included.

    When I run the main exe I get error 1026 VI reference invalid.

    Help, please

    Thank you

    Choose the layout of the 8.X file will change the path that your screw referenced are when you build your executable file.

    http://zone.NI.com/reference/en-XX/help/371361K-01/lvconcepts/referencing_files_in_applications/

    If you choose this option of layout, you adress just the vi you are calling where having the option deselected will mimic your file structure layout it is developing.

  • Perform a sequence using the new method of execution

    Hi ppl,

    I use the Engine.NewExecution method in LabVIEW to perform a sequence using sequential process model. I have been successful in this attempt.

    Now when I tried to pass arguments to the sequence with this method I could not do

    From the help file, I found to pass property to the sequenceArgsParam in the Engine.NewExecution. I used the Engine.NewPropertyObject to create a new property object. My problem started here. I was not able to define the parameters for the property object I created. When I created an object of type container property, newExecuion method returned an error indicating that the type is the string even if the setting for my sequence was a container. When I created a method of setValString string property object returned error saying unable to find settings where the look of string upward was parameters.x

    Please help me some body. I'm stuck with this upward.  can someone give me an example of program that passes parameters to the sequence when running via the NewExecution method.

    Hello

    It is not the Engine.NewPropertyObject method to pass parameters

    I used to sequence method before running the sequence

    try to replace the step Engine.NewExecution of this VI

    the values are in a cluster table: parameter is the name of the parameter in your sequence, the value is the value to pass

    A2

    Note 1: there is only the string in this VI, it is possible to change with integer...

    Note 2: If you have a container, the parameter name is "container". "" The name of the parameter.

  • Project Manager fails to cut after the new method to "consolidate and transcode.

    Greetings,

    I use first to create trailers and other equipment for a game studio. For the record, I use dxtory ( http://exkode.com/dxtory-features-en.html ), with the first/AE allows you to change the images and SOUL for rendering. A project may consist of several hundreds of GB's worth of the source footage. When made with a given project, historically I used method 'trim' first since the project manager to store copies ready images - as it is intended. This can turn a project with 400 GB of source down to a cup which is only 80 GB or more. This has worked well in the past, but because of the recent change to the new feature to "Consolidate and transcode", this operation will fail when the current creation.

    I created a full repro this for anyone who would like to try.

    The repro project: https://dl.dropboxusercontent.com/u/263501/misc/PremiereRepro/Copied_transcode_repro.7z

    I'm using Project Manager, select the following options:

    https://DL.dropboxusercontent.com/u/263501/Misc/PremiereRepro/pp_transcode_2.PNG

    This should lead to a MB avi ~9.9, which is 15 images of the larger video, the panoramic nature views slightly to the right.

    Instead, I get the following message after the end:

    https://DL.dropboxusercontent.com/u/263501/Misc/PremiereRepro/pp_transcode_1.PNG

    Looking at the directory for this new project "successful", the size of the file is the same as the source of the layer and without cropping footage actually occurred.

    The journal of the events, said the same thing:

    https://DL.dropboxusercontent.com/u/263501/Misc/PremiereRepro/pp_transcode_3.PNG

    This method worked 100% reliable before the new feature to "consolidate and transcode. It seems to be quite broken in the current one, at least for my purposes. I forgot something, or is this a bug? I am currently having to install an earlier version of first trying to work around this problem, but this obviously isn't the solution.

    You receive this warning as the selected Format (DNxHD MXF OP1a) does not support your combination of the size of the image, frame the combination of rate and on the ground. For example, DNxHD will support sizes 1280 x 720 or 1920 x 1080, while your source file is 1280 x 800.

    Try using a combination of Format/Preset that will support your settings of the source file. For example: Source of game (Mac) ProRes or CineForm Match (Mac and Windows).

    I hope this helps.

  • Call the static method from Acrobat to c#

    I have a static function of C++ and I want to call this function from c# code (it's a button_click event). I tried to export this function by creating its DLL, but it does not work. My C++ function looks like this: static ACCB1 Sub ACCB2 HighlightWord(void *data). Please give some advice?

    When you say "expose plugin methods c# in a standardized manner", it means the plugin itself must be built as COM, so that its methods are exposed?

    If so why do I need to expose COM plugin together when I need to call only one method of plugin? Please specify.

    In addition, the project plugin C++ is unmanaged code. A wrapper around plugin is necessary, so that it can be exposed to c#. My understanding is correct?

  • Windows XP Pro - Restore backup full to the new hard drive Questions

    My HD player (only four years, ARGH) for my Dell Dimension 4700 threw the sector of disk errors in Event Viewer.  I tried disc analysis to fix and it did not help.  I did a full backup, including the State information system on an external hard drive using backup utility Windows XP Pro.  I don't have an emergency boot disk, just the XP PRO installation disc.

    I have the new drive (Sata 320 GB rather than Sata 80 GB) installed and loaded with Windows XP again.  I am able to connect and fix the external hard drive and want to restore my old information.

    I think that I should restore the backup file using Windows XP with security, junction points, and above all, preserve the mount points for the reader verify that Yes.

    It is the appropriate procedure to restore a full backup to a hard drive nine?

    Restoration of the old registry to the backup will damage the install drive?

    Thank you

    RCH2330


Maybe you are looking for

  • Firefox stop stop with question

    Hello. When I stopped with the open web pages, Firefox produces a dialog box asking if I want to stop. Can I turn off this feature, as well as Firefox shutsdown Windows without asking. Under Firefox Windows 35.0 8. Thank you.

  • MacBook Pro disconnects Internet randomly

    Hi friends, I have a Macbook Pro of the retina (11.3 end 2013) gives me a headache with WiFi at home. In my Studio, where I have another internet provider, it works well, but in my house is disconnect randomly. I have an apple TV, two ipads, an iphon

  • Virtual store Toshiba account reset - 33421

    Hi friends:Please reset account 33421 Thank you

  • LPT1 port not found

    LPT1: cannot find the specified file.  Having a problem with Printfil.exe.  Dos2usb.exe already removed and checked antoexec.nt lpt1 for unique capture programs, which does not appear in autoexec.nt.  The error "Cannot find the file specified" appear

  • DBSS - connection time

    Can someone tell me what DBSS - connection time please? It's time to get a connection or as long as a link or something totally different? Thank you