Package/Class/Function Problem

From the Getting Started Lessons in Flex Builder 2, one thing
I am trying to learn (but failing) is how to use the TimerEvent
class. The sample uses the following code:
package
import flash.display.Sprite;
import flash.events.TimerEvent
import flash.utils.Timer
public class ShortTimer extends Sprite
public function ShortTimer()
// creates a new five-second Timer
var minuteTimer:Timer = new Timer(1000, 5);
// designates listeners for the interval and completion
events
minuteTimer.addEventListener(TimerEvent.TIMER, onTick);
minuteTimer.addEventListener(TimerEvent.TIMER_COMPLETE,
onTimerComplete);
// starts the timer ticking
minuteTimer.start();
public function onTick(evt:TimerEvent):void
// displays the tick count so far
// The target of this event is the Timer instance itself.
trace("tick " + evt.target.currentCount);
public function onTimerComplete(evt:TimerEvent):void
trace("Time's Up!");
I cannot get this code to work any way I try it. If I put the
code in an mxml app it gives back an error that a package cannot be
nested. If I put the code in its own component file, I cannot get
anything (like a button) to call the ShortTimer function to run the
Timer.
I tried the following code in an mxml app to call the
function that is in the component file and I named the package
Whatever and put the component in a folder named Whatever within
the project.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[
import Whatever.ShortTimer;
]]>
</mx:Script>
<mx:Panel height="100%" width="100%">
<mx:Button id="PushMe" label="Push Me!"
click="Whatever.ShortTimer;"/>
</mx:Panel>
</mx:Application>
If I click the button in debug mode, nothing happens. I would
have thought the above eventlistener in the click event would need
to have open and close parens after it, but if I put them in there
it comes back with an error about not having enough arguments (why
would the ShortTimer function need an argument anyway?).
Can anyone please help me? I am sure I am missing out on some
simple syntax or Flex Builder 2 setup that I have yet to
understand.
Thanks

Sweet! Thanks. I am not used to creating an instance of a
class since my background is from mostly VBA programming. I had the
import statement, but not the variable creating an instance of my
timer class. I kept trying to simply call the function by using its
name in the click event of a button. It all makes sense now.

Similar Messages

  • Instantiation order: package , class , function

    hello;
    I have a document class, booger.as:
    package
    trace( "package " );
    import flash.display.Sprite;
    public class booger extends Sprite
    trace( "class " );
    public function booger ()
    { trace( "function " );
    I would expect the firing order to be:
    package
    class
    function
    but the output says otherwise:
    class
    package
    function
    any thoughts?
    thanks
    dsdsdsdsd

    Sweet! Thanks. I am not used to creating an instance of a
    class since my background is from mostly VBA programming. I had the
    import statement, but not the variable creating an instance of my
    timer class. I kept trying to simply call the function by using its
    name in the click event of a button. It all makes sense now.

  • Importing Inter-package classes

    hello
    I have never had this problem before but I just 'downgraded' to JDK 1.1.8 because the code will be used on my PDA. I am trying to import Inter-package classes but the compiler it cannot find the classes I've imported. This code was working perfectly in j2sdk1.4.2_02
    I think the code is right all files saved in folder graphs and beginning looks like this:
    package graphs;
    import graphs.AxisParameter;

    Yes they are in the same folder with 'package graphs;' in the 1st line,
    i've tried with and without package.class to no avail
    the exact errors i'm getting are
    without the package in front
    error: File .\CustomLabel.class does not contain type CustomLabel as expected, but type graphs.CustomLabel. Please remove the file or make sure it appears in the correct subdirectory of the class path
    with the graphs.CustomLabel i get the following errors
    error: Invalid class File formate: .\graphs\CustomLabel.class, wrong version: 46, expected 45
    2nd error: Class graphs.CustomLabel not found in import.

  • Loading Variables in a Class Function

    I am having problems loading variables from an external text
    file inside of a class function. The text file has been created
    properly, and the code that I use in the class is as follows:
    _root.createEmptyMovieClip("texRules", -100);
    loadVariables("texRules.txt", _root.texRules);
    m_Rules = _root.texRules.rules;
    I create an empty movie clip on the root frame named
    texRules, load the variables into that movie clip with the next
    line and then set my member string value equal to the text file
    variable named rules. When I run the program, I get an undefined
    for my m_Rules.
    Here is my texRules.txt:
    rules=THESE ARE THE TEXAS HOLD'EM RULES.
    Any ideas as to what I am doing incorrectly?

    I've opted to use the LoadVars instead of creating an empty
    movie clip and loading the variables there. Here is my new code.
    public function setRules():Void
    var rulesLoader:LoadVars = new LoadVars();
    rulesLoader.onLoad = function (success:Boolean):Void
    if (success)
    trace(rulesLoader.rules);
    this.m_Rules = rulesLoader.rules;
    else
    trace( "Unable to load external file.");
    rulesLoader.load("texRules.txt");
    Here is where I define my properties of my class:
    class TexHoldem extends Game
    //Class member properties
    //Private Properties
    private var m_Rules:String;
    private var m_Target:MovieClip;
    Here is my constructor:
    public function TexHoldem(target)
    this.m_Target = target;
    super("Texas No Limit Hold'Em", 0, 1);
    setRules();
    The setRules function works fine, the only problem now is
    that I can't save the variables once the onLoad function goes out
    of scope. I've thought of modifying it so that it returns a type,
    but that seems difficult. The two easiest solutions I see is to
    create an empty text field that holds the string or find a way to
    get the rulesLoader.rules outside of the onLoad scope. Any
    suggestions now? Sorry to change the problem on you.

  • Static Class Function vs. Instance Variables

    I'm making a Wheel class to spin the wheels on some toy
    trains as they move back and forth.
    Each wheel on the train is an instance of the Wheel class and
    there are several of them.
    I thought it would be great to just have a static class
    function to tell all the Wheels to start turning:
    Wheel.go();
    The Wheel class keeps a static array of all of its instances
    so I thought I would just loop through all of those instances and
    issue the wheelInstance.roll() method.
    So far it all works. But I was planning to use a setInterval
    to call the roll() method and each instance has its own rollID
    property that I would like to assign the setInterval ID to. Here is
    the problem.
    Since the rollID is an instance property I can't access them
    from a static class function. Is there any way to do this?
    Currently I"m just using an onEnterFrame which doesn't require me
    to use the instance properties.

    Technically yes, realistically for this class no.A
    class will probably take several hundred bytes at
    least to load, with no data of your own. So adding4
    bytes for a int is less than 1% of the total size.
    And if you are loading millions of differentclasses
    then you should rethink your design.If you don't instantiate the class when you reference
    a static variable why would you consume memory for the
    class other than the variable itself? I don't
    understand what you are talking about with the
    "millions of different classes", it's not germane to
    the question. Bottom line, referencing a static
    variable more than once will save memory.Using a class, static or by instance, requires that the class be loaded. A loaded class creates, at the very least, an instance of java.lang.Class. Any static members of the class are in addition to the storage space needed for the instance of java.lang.Class and for any internal storage needed by the JVM in addition to that.
    Thus if one has a static data member when the class is used in any way, the static data member takes storage space. However a member (non-static) does not take storage space.
    Of course the meta data for the member could take as much space as the static member so the point could be moot. Is that what you were referring to?

  • Content Exchange -- Package Upload function not work.

    I try to upload a zip file from my computer into the repository by using package upload function in portal. The file size export by ice is 1.09 GB is not work it has error The page cannot be displayed but small file size is work. How can i do?

    Hi folks,
    same problem here while trying to transport a large KM package (28GB à 2GB volumes) from EP 7.0 to EP 7.31 SP6. The package upload iView in my target system EP 7.31 crashs with "This page cannot be displayed". I cant find any appropriate exceptions in NWA.
    I guess ICE transport isnt an option at all for transporting KM content from 7.0 to 7.31 (http://scn.sap.com/thread/3249426), but i tryed it also, without any success, same behaviour. As i stringent need all metadata (ACL's for example), WebDAV is probably also not reasonable, as far i know you cant transport KM metadata with this method.
    Unfortunately Detlev`s link dont works, so i cant get any clues from there. I also tryed to split one KMC archive in volumes à 100MB, but it dont works, because the following volumes are not uploaded and i cant see any KM packages at all.
    So, i know i can create smaller KM packages manually, but regarding the data amount its extremly time-consuming. I cant imagine our colleagues from SAP AG are regarding the case of a KM import of large files as realistic, but dont give us a working option to import them. Does anybody have any idea how to handle this issue? Thank you in advance,
    best regards

  • Work on FB4.5 and Flash5.5 simultanoiusly - lack of code hints and default package classes.

    Hi!
    I setup Flash Professional CS5.5 and FB4.5 to work together. I just followed this tutorial: http://www.adobe.com/content/dotcom/en/devnet/flash-builder/articles/sharing-projects-flas hbuilder-flash.html and almost all looks good, but unfortunately working in Flash Builder adding new Classes I do not have default package Classes accessible. This way I can not even declare Sprite, Array class and so on. In code hints I only gets my current package classes.
    I set the .fla project inside Flash CS5.5 with some folders as the package for my classes. It is for examle:
    com.myDomain.testProject where DocClass exists. By adding this path as the document for FlashCS5.5 all works great, I can easily run, debug movie in the Flash environment.
    Setting this project by 'Import'->'FlashBuilder-FlashBuilderProject'->'ProjectFolder' pointing to the .fla file it seems that the thing goes well. The project is set and even I had some problems with Document Class's name (it seems that Flash Builder need to have Document Class with the same name as the .fla flie) and renaming it I can run or debug it and it works.
    But if I try to add new class to the directory I end up with no code hints, and in fact no default package classes support. That means I get errors trying to create instance of any common class etc. In code hints I am only getting my package hints (look picture)
    Maybe I misunderstand of some package basics and did something wrong, but generally I don't want to put all my classes to the .fla location but to sort them up in specific folders cause I assume that the project is quite large.
    If you can help me, thanks in advance. You know messing up with the code is a part of the programmer nature, and when one finds the answer he feels like a king. When to deal with environments like that, there is never joy and hapiness, but in most occasions couple uncensural words in the end, and a glimpse on the watch - agrrrhh I lost so much time :/
    cheers

    upss, It seems the Flex sdk wasn't added automatically what I didn't noticed. Looked for errors in some other areas (as always)
    Thanks anyway:)

  • Eclipse - how to share a package/class with 3 diff projects

    Hi all,
    I have 3 projects that are customized diffrently but one package is same for everyone (sharedClass). The problem is when I add/delete/update the SharedClass I have to do it 3 times (for each project)
    Question: How can I share the package/Class with the 3 projects? I mean, I want to change it once and the effect will take place to all 3 PROJECTS.
    Thanks
    Ppr

    This is an Eclipse question and doesn't really belong here, but:
    I would put the shared package into its own project. Then for the three projects (after removing the shared package) I would use the Project menu and choose properties. Choose Java Build Path snd select Projects. Choose Add and select the project containing the shared package.

  • The "Package" class

    Hi all,
    Why the java.lang.Package class is not declared final?
    Thanx,
    Adrian.

    I will give you an example:
    During two weeks I'm trying to understand the
    class-loader mechanism.
    I read every possible article I could found - and
    still I find that it
    is a mysterious design. That's because the Java
    platform (as Microsoft's platform) is an evolving
    platform, and today's solutions come to repair
    yesterday's mistakes.
    Yet, another example is AWT/Swing.Maybe you don't understand the meaning of 'bloated' because being "mysterious" has nothing to do with being bloated. The class-loader mechanism is not mysterious to me and I don't see why Package not being final makes it mysterious. It's impossible to extend Package so making it final wouldn't have any functional effect, though, for completeness it would make sense to mark it final.

  • Common SAP MM Functional problems

    Fellows
    Is there anyone who can explain some common SAP MM daily functional problems. im junior consultant and want to be prepared for interviews. you may just state them in point form briefly.
    thanks
    rash

    Common Issue
    1)Vendor is not created for Purchasing Organisation XXXX.
    2)Though Vendor Master is Flag for Deletion ,Vendor is shows at the time of PO Creation.
    3)How to extend the materials for another storage location
    4)How to Create the PO for Different Currencies.
    5)While Posting The Doc . Error Occure,1) Account Determination for Entry 1000 BSV _ _ not Posssible.2)  Account Determination for Entry 1000 FRL _ _ not Posssible.
    6)Not Authorisation for Movt Type ......,Transaction Code......
    7) Account Determenation for transaction ....  Cost center ...does not maintain.
    8)While Creation of GR -Authorisation missing for Company Code 0000 Asset Class XXXX,
    9)While Removing The Stock of material by Cancelling the Goods Receipt Doc.Error occur that Stock Qty difficial by xx No.
    10)While GR Cancellation error occure that document does not contain any selected item.
    11)While Creating Service Entry Sheet Error occured that Qty entered  exceeded by Qty in PO
    12)While cancelling the matl.Doc Error occure that matl is deficit of sales ordr stock.
    13) Error-Tax code does not Exist while creating Miro
    14)TDS Amount is not Captured at Miro entry.
    15)While Miro error occure that No suitable item found for Purchase Order.
    16)User ID gets Blocked due to wrong Password entered more than 3 times.
    18)Error-Gl account does not created for Chart of account XXXX while Miro
    19)In Purchase Order Service tax is 12.24 % and at Bill service tax is 10.5 .How to adjust it and How to cancell Wrong Miro
    20)Stock Statement not matched Value still lying into Stock A/c
    Rewards if Helpful...
    Regards
    Sanjay L

  • Help! How to create Jar file for a packaged class?

    Hi!
    I am new in jar complexities. I made a swing frame that just prompts a JOptionPane when executed. I accomplished the same using jar without packaging my class SwingTest.
    But when i package it, it doesn't run. Can any one tell me how to make jar file of packaged classes and include images in the jar files too!
    Really Thanx!

    Call the Jar from the commandline to see the exceptions thrown.
    java -jar <jarFileName> <className>

  • How to run a class function on the click event ?

    Hi Tecs,
    i want tht when someone click on some paricular location on the form, then the class function must be called with some parameter, when someone click on some other location, the function should be called with different parameters.
    How this can be done , plz help.
    Thnx in advance.

    Almost every tag supports onclick .. For example h:panelGrid and even h:form.
    JSF<h:panelGrid onclick="document.getElementById('formId:hiddenActionId').click(); return false;">
        <h:form id="formId">
            <h:commandButton id="hiddenActionId" value="action" actionListener="#{myBean.action}" style="display: none;">
                <f:attribute name="param1" value="value1" />
                <f:attribute name="param2" value="value2" />
            </h:commandButton>
        </h:form>
    </h:panelGrid>MyBeanpublic void action(ActionEvent event) {
        String param1 = (String) event.getComponent().getAttributes().get("param1"); // returns "value1"
        String param2 = (String) event.getComponent().getAttributes().get("param2"); // returns "value2"
        // do your thing
    }[EDIT]You really cannot avoid JavaScript. Heck, JSF itself also generates a heap of JavaScript ;)
    Message was edited by:
    BalusC

  • Im trying to download itunes 10.5 but keep getting error message that says: There is a problem with this Windows Installer package. A problem run as part of the setup did not finish as expected. Contact your support personnel or package vendor.

    im trying to download itunes 10.5 but keep getting error message that says: There is a problem with this Windows Installer package. A problem run as part of the setup did not finish as expected. Contact your support personnel or package vendor. I am using windows XP 32 bit, all the other computers in my house downloaded just fine, no problems, however this is the computer my iphone is set up to, ive tried doing a virus scan, windows update, downloading other things, updating everything possible, everything works fine, its just itunes that wont download, anyone have any other ideas?

    Yes, I had found a similar solution also.  I'm running XP Pro, SP3.  I went Control Panels/ Add-Remove programmes/apple software update/ change/ repair.  Then run the 10.5 exe.
    While the programme updated from version 8 of iTunes, my new iTunes is now a mess.  Not all of my music was in the same folder previously but it all showed up on iTunes.  Now many albums have been left out, some have only a few tracks and some have two copies of some tracks as well as having other tracks missing.  I haven't begun to work on that.

  • Has anyone had a problem with TapMedia File Manage on iPhone 5. I reported a WIFI functionality problem to the developer and asked for support. Instead they have been very unprofessional by name calling me instead of logically evaluate and troubleshoot th

    Has anyone had a problem with TapMedia File Manage installed on iPhone 5? I reported a WIFI functionality problem to the developer and asked for support. Instead the company has been very unprofessional by name calling me instead of logically evaluate and troubleshoot the problem

    Hi AKE1919,
    Welcome to the Support Communities!
    The following information should help you with this:
    How to report an issue with your iTunes Store, App Store, Mac App Store, or iBookstore purchase
    http://support.apple.com/kb/HT1933?viewlocale=en_US
    Cheers,
    Judy

  • Encryption of pl/sql package/procedures/function code

    Is it possible to make the code inside a package/procedure/function un readable to other users.
    As is some of the api package body code in portal ?
    thanks in anticipation.
    SD,

    PL/SQL Wrap Utilityhttp://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/c_wrap.htm#LNPLS016
    Note, however that you cannot revert back to original un-wrapped code from a code that has been wrapped. You would need access to the original source files to get the original source code.

Maybe you are looking for

  • Error while opening WebAnalysis reports

    Hi , We are experiencing a strange problem with Web Analysis reports. When a user tries to open a web analysis report, it fails with the below error message. Error occured while opening document. Document ID = {0}. But if the same user tries it from

  • JUNK CHARACTERS IN REJECTED_RECORD COLUMN IN CUBE_REJECTED_RECORDS TABLE

    After maintaining the cube, for the rejected rows, we are seeing the error message "A column value is not a valid member of its target dimension." but the rejected record column shows junk characters. We want to be able to read this column so that we

  • How to fix width of plain text content control in Microsoft Word 2010?

    I try to make the simplest solution for my custom to modify current Word template without hard code anything except field name. As you can see above image, normally text field in Word is not fixed width control. So, it may affect document layout. Mor

  • How to handle vertical format - 720 x 1280

    What is the best way to output to 720 x 1280 vertical format? I have a video I want to display in a right column of a web site but the question would be the same for producing product promos such as what you see at WalMart. Premiere Pro CS5 (shooting

  • What is table of Rate field in Sales Order document (VA03)?

    Hello everyone! I need to check in what table is the Rate value in the Sales Order document saved.. Unfortunately, it is not in VBAP as I first expected. Only the Net price is there, not the Rate. Thank you very muchh!