Typecasting String to Function in AS3

Hi,
I would like to typecast a String to Function. The following is the code snippet,
var  
var funcionVar:Function = functionName as Function;
bt.addEventListener(MouseEvent.CLICK,funcionVar);
public function onSearch(event:MouseEvent) {
// Code here
While converting String to Function, it is returning null value. Is there any possible ways to achieve this?
Thanks,
Srinivasan S
  functionName:String = "onSearch" ; 

This is the code snippet,
var functionName:String = "onSearch";
var funcionVar:Function = functionName as Function;
bt.addEventListener(MouseEvent.CLICK,funcionVar);
public function onSearch(event:MouseEvent) {
// Code here
Could you please help to resolve this?
Thanks,
Srinivasan S

Similar Messages

  • Typecasting String to Date using as operator

    Typecasting String to Date using as operator
    I am doing -
    dateId.text as Date;
    but it returns null;
    How should I typecast String to Date in particular format
    like "MM/DD/YYYY"

    "MBhatt" <[email protected]> wrote in
    message
    news:gnlh6f$5gs$[email protected]..
    > Typecasting String to Date using as operator
    >
    > I am doing -
    >
    > dateId.text as Date;
    >
    > but it returns null;
    >
    > How should I typecast String to Date in particular
    format like
    > "MM/DD/YYYY"
    Date has a parse method, and I think DateField has methods
    for this.

  • How to know the no. of bytes in a String Control Function?

    Hi,
    I would like to know the no. of bytes for a certain String Control Data.
    For instance, if i have a String Length Function, on the left is a String Control and on the right is a Length Indicator.
    If i will type coordinates, i.e. 9.25,4.25 on the String Control it will show 9 on the Length Indicator. I think 9 do not mean 9 bytes but
    only a length. Is there any function in LV that will tell me the total bytes of the data on the string control?
    Appreciate for any advise.
    Thanks a lot.

    Thanks tst for your kind reply.
    Here is what i am trying to find/goal.
    I will be using wireless receiver for my system. The wireless receiver have some signal strength ranges; 95dbm @ 1Mbps (mega bit per sec), 90dbm @ 11Mbps, 82 dbm @ 24 Mbps and 75dbm @ 54 Mbps. Ofcourse i prefer to have lower data transfer rate so that my signal strength is best.
    I will be sending coordinate data/s via wireless communication using string controls. But i do not know how big/heavy is my coordinate data
    If i can know how many bytes or mega bytes the data i want to send then i will be able to transfer it to bits or mega bits(8 bits = 1 byte) thus i will know which setting i can use for the wireless receiver. And if the data is too big then i have a basis to redesign my data transfer to suite a better signal strength.
    Thanks for your help.

  • Pad leading zeros in a string.Format function

    How could use the string.Format function and in the format text pad a leading zero? 
    Pseudo code is:
    string parm = “5”;
    string format = “Some number formatted as 3 dig: Format({0}, 000)”;
    string output = string.Format(format, parm);
    Where the output would look like this:
    “Some number formatted as 3 dig: 005”
    Thanks.

    Thanks everyone. Unfortuantly there's a constraint where the padding operation needs to be embedded in the format string. This entire operatin is being put together dynamically where the format strings are being pulled from a library of format strings stored
    in a database. at runtime we don't know how which format will be used and how many parameters will be passed in. we have logic to handle the unknown number of paramters as there is metadata which helps us with that.
    the need for leading zeros needs to be part of the overall format defined in the format string.  for example, a real format string stored in the database looks like this:
    "LINE_NO = '{0}',  AND GEO_LOCATION = 'T{1}, {2},  R{3}, {4}, , Sec. {5}'"
    and its output from the string.Function is:
    "LINE_NO = 'TG-G2469',  AND GEO_LOCATION = 'T155, N,  R93, W, , Sec. 5'"
    the last parameter (param 5) had a value of 5.  In another case the output requirement might need to look like this:
    "LINE_NO = 'TG-G2469',  AND GEO_LOCATION = 'T155, N,  R93, W, , Sec. 05'"
    note the "05" at the end...
    the logic of using the leading zero needs to be embedded in the overall format string text.
    Thank you.

  • Determine length of string without function module

    hai experts,
    i need to know how to determine length of string without function module strlen'
    regards,
    karthik

    Please SEARCH in SCN before posting.

  • TypeCasting String To List

    Is ther any possible way to typecast String to List...
    thanks

    Is there any way to spread the Cuban Missile Crisis
    on your toast? No. It's a mismatching of concepts
    Much like Strings and Lists. But I bet your actual
    problem is something different. Why did you want to
    do this?
            String s = "Test String";
            char[] sca = s.toCharArray();
            ArrayList<Character> l = new ArrayList();
            for(char c : sca) {
                l.add(c);
            }l is your Listy String.
    Yay!

  • Simple String Compression Functions

    Hi all !
    I need two simple String compression functions, like
    String compress(String what)
    and
    String decompress(String what)
    myString.equals(decompress(compress(myString)))
    should result in true.
    Primarily I want to encode some plain text Strings so they are not too easy to read, and compression would be a nice feature here.
    I already tried the util.zip package, but that one seems to need streams, I simply need Strings.
    Any ideas ??
    thx
    Skippy

    It does not do any compression, in fact it does
    expansion to better encrypt the string (about 50%).How does that work? You want encryption to
    decrease entropy.Why in the world do you say that, pjt33? What a very odd statement indeed. I sure hope you don't work in security, or I do hope you work in security if I'm a bad guy, or a competitor.
    Let's say you had a 6-character string you wanted to encrypt.
    Well, if you didn't increase the entropy, any 6-character plaintext string would have a 6-character encoded equivalent. And if you decreased entropy (e.g. coding the most commonly used words to shorter strings,) it gets even easier to decrypt.
    Presumably there would be no hash collisions, after all, you want this to be reversible.
    Hash collisions decrease entropy too, and, by doing so, make it easier to find a plaintext string that happens to hash to a certain value. This is a Bad Thing.
    Now, to decode this, the Bad Guy only has to consider the set of 6-character strings and their hash values. You could even precalculate all of the common dictionary words, and everything with common letters and punctuation, making decryption virtually instantaneous. Especially if you had decreased the entropy in the signal, making fewer things I had to try.
    But somebody who increased the entropy of their signal by adding random bits and increasing the encrypted size of the message to, say, 64 characters, would make it a lot harder to decrypt.
    The ideal encryption system is pure noise; pure randomized entropy. An indecipherable wall of 0 and 1 seemingly generated at random. Statistical methods can't be used against it; nothing can be deciphered from it; it's as decipherable and meaningless as radio hiss. Now that's encryption!

  • Annoying String to Float in AS3

    Hey again,
    I am working on *AS3* here.
    Problem: I have a value stored in a String. I'd like to check
    whether
    that String is a float. I am aware of the method
    parseFloat(string)
    described here:
    http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/
    actionscript_dictionary620.html
    However, this method has annoying limitations:
    parseFloat("2.5") will be 2.5
    parseFloat(" 2.5") will be 2.5
    parseFloat("2.5garbage") will be 2.5
    parseFloat("2.5garbage3.2") will be 2.5
    it will only be NaN if the value of the string starts with a
    non-
    numerical character
    parseFloat("garbage2.5") will be NaN
    So doing something like that, will not work for me:
    public function isFloat : Boolean(str : String) {
    if (isNaN(parseFloat(str))) {
    return false;
    return true;
    I want to check if the string is a *real* float that is:
    isFloat("2.5") will be true
    isFloat("x2.5") will be false
    isFloat("2.5x3.2") will be false
    isFloat("2.5x") will be false
    Basically, no spaces or non-numerical characters should be
    allowed
    (expect the one dot '.' if required).
    I'm thinking of implementing my own isFloat method, checking
    character by
    character to see if the value is really a float or not.
    Something like
    that (quick draft, haven't tested it or compiled it):
    public function isFloat : Boolean (str : String) {
    var dotUsed : Boolean = false;
    for (var i : int = 0; i < str.length; ++i) {
    if (str.charAt(i) == '.') {
    if (!dotUsed) {
    dotUsed = true;
    } else {
    return false;
    } else if (isNaN(parseInt(str.charAt(i)))) {
    return false;
    However, I'm not happy with the runtime efficiency here. I'm
    sure there's
    some more efficient way to detect that a string is a float;
    or another
    simple method I haven't look at.
    Any thoughts?
    Thanks

    You can avoid the looping test by using a regular expression.
    Basically the whole check could be done with a regular expression.
    I'd love to provide the code, but regular expressions are new to me
    as well. I had a play around with them and got close, but it didn't
    pass all the tests, so I wasn't doing something right. Someone else
    will post an example I'm sure.

  • Converting AS2 XML Function To AS3

    Hi guys, how are you?
    Once again I´m here to request your help.
    I´m trying to convert an AS2 to AS3 script, but I´m not good at AS3 sintax yet. I don´t know how to create this structure. Please, someone could help me?
    xml:
    <resources>
             <levelTitle1>Iniciante</levelTitle1>
              <levelTitle5>Aprendiz</levelTitle5>
              <levelTitle10>Aspirante</levelTitle10>
              <levelTitle15>Recruta</levelTitle15>
              <levelTitle20>Experiente</levelTitle20>
              <levelTitle30>Profissional</levelTitle30>
              <levelTitle50>Star</levelTitle50>
              <levelTitle70>Ás</levelTitle70>
              <levelTitle90>Campeão</levelTitle90>
              <levelTitle120>Lenda</levelTitle120>
    </resources>
    AS2 Function:
    public static function getLanguage(tag:String):String
               if (languageObject[tag].data){
                        return slanguageObject.resources[tag].data;
                 return "Error";
    I can´t figure out how to work in as3 without the "data" parameter.
    I would like to call this as2 function, pass "levelTitle30" to  the parameter "tag", and get back by return of the function  the content of  "levelTitle30"  from xml tag.
    Regards,

    is your xml in an external file?
    if yes, (eg, resources.xml), you would use:
    var xml:XML
    var urlLoader:URLLoader=new URLLoader();
    urlLoader.addEventListener(Event.COMPLETE,completeF);
    urlLoader.load(new URLRequest("resources.xml"));
    function completeF(e:Event):void{
    xml=e.target.data;
    public static function getLanguage(tag:String):String{
    if(xml[tag]){
    return xml[tag];
    } else {
    return "Error";

  • String CDF functions not working in business rules

    Working with EPM 11.1.2. I created a calc script on the planning cube and it works perfectly. I then put the same code in a business rule and it will not validate. Please see the code below.
    1) created udf folder in following directory
    essbase/Oracle/Middleware/EPMSystem11R1/products/Essbase/EssbaseServer/java
    2) modified udf policy to grant access to all
    3) saved CDF_String.jar file to new udf folder on server
    4) registered functions via maxl
    5) stop/start application
    6) stopped/started EAS services
    I get the following error in the message window (line 9 is the JGetStringFromDouble statement):
    "Encountered " "-> " "-> "" at line 9, column 35.
    Was expected one of:
    What do I need to do to get this code working as a business rule since I want to use RTPs in this routine?
    FIX("No_Profit_Center", FY07:&CapAppEndYr, "Working Plan", "Current", "Manual_Input", "LOC", @Relative("Period",0), @Relative("Project",0), @Relative("Entity",0))
    "AC_Unappr_Fcst_Depr"
      IF ( "AC_Unappr_Fcst_Depr"  == #Missing)
         IF ("FY07"->"No_Period"->"AC_Depr_CC" != #Missing)
              "AC_Unappr_Fcst_Depr"->(@MEMBER(@CONCATENATE("EN_",@JgetStringFromDouble("FY07"->"No_Period"->"AC_Depr_CC",@_False,@_False))))  = "AC_Unappr_Fcst_Depr_Temp";
        ELSE
              "AC_Unappr_Fcst_Depr" = "AC_Unappr_Fcst_Depr_Temp";
        ENDIF
      ENDIF
    ENDFIXEdited by: jjdubb on Jun 11, 2012 9:10 AM

    I've had this issue with a different string function. Business Rules does not like the boolean parameters (@_FALSE) used in these CDF's. I had a similar issue and had to rewrite my CDF without the parameters. You basically need to hardcode the "with quotes" and "with decimals" parameters in the java code.
    Hope this helps,
    - Jake

  • Problem in getting last value of a string in Function Module

    Hi,
    I am working on FM in which i have to put highfen mark which is working ok,but the problem if there is when the value of string finds a space it should not insert highfen in it and i am not able to put the condition in it as it showing the higfen even when the word is full in the first line.i want to show highfen where the word is not able to display complete. here is d code which i am using right now. plzz provide me guidlines to solve this problem.
    here's d code:-
    FUNCTION Z_STRING_LENGTH1.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(I_STRING) TYPE  STRING
    *"     VALUE(LENGTH) TYPE  I
    *"  EXPORTING
    *"     VALUE(E_STRING) TYPE  STRING
    data: STRING_F type string, "Stores the value in string format
          STRING_LENGTH type i, "Length of the string
          DIFF type i,          "Difference among the value
          DIFF1 TYPE C,
          STRING1 type string,  "Stores the 1st String
          STRING2 type string,  "Stores the 2nd String
          STRING3 type string,  "Stores the 3rd String
          STRING4 type string,  "Stores the 3rd String
          STRING5 type string,  "Stores the 3rd String
          LENGTH2 type I.
    STRING_F = I_STRING.
    STRING_LENGTH = STRLEN( I_STRING ).
    DIFF = STRING_LENGTH - LENGTH.
    IF DIFF LE 0.
      DIFF = 0.
    ENDIF.
    IF LENGTH LE STRING_LENGTH.
      STRING1 = STRING_F(LENGTH).
    ELSE.
      STRING1 = STRING_F(STRING_LENGTH).
    ENDIF.
    IF LENGTH LE STRING_LENGTH.
      STRING2 = STRING_F+LENGTH(DIFF).
    ELSE.
      STRING2 = STRING_F+STRING_LENGTH(DIFF).
    ENDIF.
    length2 = length - 1.
    STRING3 = STRING1+length2(1).
    STRING4 = STRING2+0(1).
    IF LENGTH LE STRING_LENGTH AND STRING3 NE SPACE AND STRING4 NE SPACE.
      concatenate STRING1 '-' STRING2  into STRING5.
      e_string = STRING5.
    ELSE.
      concatenate  STRING1 STRING2 into STRING5.
      e_string = STRING5.
    ENDIF.
    ENDFUNCTION.
    Edited by: ricx .s on May 12, 2009 5:20 AM

    Hi,
    I checked your code... its working fine except for some cases it is giving dumps for which I have added certain if conditions....
    Please check the modified code below... have optimized it as well by removing one extra if condition....
    you can copy and paste the code below...
    DATA: STRING_F TYPE STRING, "Stores the value in string format
          STRING_LENGTH TYPE I, "Length of the string
          DIFF TYPE I,          "Difference among the value
          DIFF1 TYPE C,
          STRING1 TYPE STRING,  "Stores the 1st String
          STRING2 TYPE STRING,  "Stores the 2nd String
          STRING3 TYPE STRING,  "Stores the 3rd String
          STRING4 TYPE STRING,  "Stores the 3rd String
          STRING5 TYPE STRING,  "Stores the 3rd String
          LENGTH2 TYPE I.
    STRING_F = I_STRING.
    STRING_LENGTH = STRLEN( I_STRING ).
    DIFF = STRING_LENGTH - LENGTH.
    IF DIFF LE 0.
      DIFF = 0.
    ENDIF.
    IF LENGTH LE STRING_LENGTH.
      STRING1 = STRING_F(LENGTH).
      STRING2 = STRING_F+LENGTH(DIFF). " added this statement in this if itself instead of one extra if
    " which is not required
    ELSE.
      STRING1 = STRING_F(STRING_LENGTH).
      STRING2 = STRING_F+STRING_LENGTH(DIFF).
    ENDIF.
    IF LENGTH IS NOT INITIAL.
      LENGTH2 = LENGTH - 1.
    ENDIF.
    " put this if condition as there is a dump occuring at this place.
    " Dump occurs when you give the length value as 0
    " Say for example the value of I_STRING, I passed it as SIDDARTH
    " and the length I passed as 0, then it gives me a dump
    STRING3 = STRING1+LENGTH2(1).
    IF STRING2 IS NOT INITIAL.
      STRING4 = STRING2+0(1).
    ENDIF.
    " put this if condition as there is a dump occuring at this place.
    " Dump occurs when you give the length value greater than or equal to
    " the string length
    " Say for example the value of I_STRING, I passed it as SIDDARTH
    " and the length I passed as 8, then it gives me a dump
    IF LENGTH LE STRING_LENGTH AND STRING3 NE SPACE AND STRING4 NE SPACE.
      CONCATENATE STRING1 '-' STRING2  INTO STRING5.
      E_STRING = STRING5.
    ELSE.
      CONCATENATE  STRING1 STRING2 INTO STRING5.
      E_STRING = STRING5.
    ENDIF.

  • Maximum length of query string for functions return a SELECT

    Hi all,
    I have a report that gets it's SELECT statement from a function, instead of being coded into the region. All was well but I suspect now I'm blowing some kind of limit as I'm getting an error :
         ORA-06502: PL/SQL: numeric or value error
         Error      ERR-1101 Unable to process function body returning query.
    However if I run the procedure out of ApEx and grab the SELECT statement then it works fine. The length of the query is 8636 bytes (yup, it's a beauty!).
    Does anyone know if there is a hard limit to the size of the string that can be returned?
    I'm using ApEx 3.1.
    Thanks,
    Steve H

    I do have a similar painfull scenario - Although my query length is very less i.e 618 bytes only.
    I have defined a stored function, which returns an SQL query string, this return SQL string executes fantastic but when I tried to to call this function from a APEX report it gives error. the details are as follows. Please help.......
    The function code:
    CREATE OR REPLACE function PROD."TEST_C_QRY"
    return VARCHAR2
    is
    msql VARCHAR2(32767);
    Begin
    msql:='Select null,statusname,AgeInd, ';
    For m_stat in (select statusname from a02_status)
    loop
    msql:= msql || q'[decode(statusname,']';
    msql:= msql || m_stat.statusname;
    msql:= msql || q'[',count(id),0) ]';
    msql:= msql || m_stat.statusname|| ',';
    end loop;
    msql:=rtrim(msql,',');
    msql:= msql||' from ';
    msql:= msql||'( ';
    msql:= msql||'select a.id, round(sysdate-a.registeredon) TimeSpan,';
    msql:= msql||'case ';
    msql:= msql||q'[when round(sysdate-a.registeredon)<=7 then 'Week' ]';
    msql:= msql||q'[when round(sysdate-a.registeredon)>7 and round(sysdate-a.registeredon)<14 then 'Fortnight' ]';
    msql:= msql||q'[when round(sysdate-a.registeredon)>14 and round(sysdate-a.registeredon)<30 then 'Month' ]';
    msql:= msql||q'[else 'More...'  end ageind,]';
    msql:= msql||'a.status_id,b.statusname ';
    msql:= msql||'from a02_task a,a02_status b ';
    msql:= msql||'where b.id=a.status_id) ';
    msql:= msql||'group by statusname,AgeInd;';
    return msql;
    end TEST_C_QRY;
    The Output SQL comes from this is
    SQL> Select null,statusname,AgeInd, decode(statusname,'Scheduled',count(id),0) Scheduled,decode(statusname,'Executing',count(id),0) Executing,decode(statusname,
    'Completed',count(id),0) Completed from ( select a.id, round(sysdate-a.registeredon) TimeSpan, case when round(sysdate-a.registeredon)<=7 then 'Week' when round
    (sysdate-a.registeredon)>7 and round(sysdate-a.registeredon)<14 then 'Fortnight' when round(sysdate-a.registeredon)>14 and round(sysdate-a.registeredon)<30 then
    'Month' else 'More...' end ageind, a.status_id,b.statusname from a02_task a,a02_status b where b.id=a.status_id) group by statusname,AgeInd;
    The result that comes when I execute the above resultant SQL is as follows.
    N STATUSNAME AGEIND SCHEDULED EXECUTING COMPLETED
    Completed More... 0 0 4
    Completed Week 0 0 1
    Scheduled Week 1 0 0
    Completed Month 0 0 3
    Executing More... 0 1 0
    Executing Month 0 6 0
    Scheduled More... 1 0 0
    7 rows selected.
    But the surprising error that comes from Oracle XE when I use the following code for stacked bar chart
    Code:
    begin
    return TEST_D_QRY;
    end;
    Error thrown by XE report builder is as follows:
    1 error has occurred
    Failed to parse SQL query!
    Select null,statusname,AgeInd, decode(statusname,'Scheduled',count(id),0) Scheduled,decode(statusname,'Executing',count(id),0) Executing,decode(statusname,'Completed',count(id),0) Completed from ( select a.id, round(sysdate-a.registeredon) TimeSpan, case when round(sysdate-a.registeredon)<=7 then 'Week' when round(sysdate-a.registeredon)>7 and round(sysdate-a.registeredon)<14 then 'Fortnight' when round(sysdate-a.registeredon)>14 and round(sysdate-a.registeredon)<30 then 'Month' else 'More...' end ageind, a.status_id,b.statusname from a02_task a,a02_status b where b.id=a.status_id) group by statusname,AgeInd;
    Certain queries can only be executed when running your application, if your query appears syntactically correct, you can save your query without validation (see options below query source).
    Regards,
    Soumen

  • Parsing xml using the .text() function in as3

    I am accessing an xml document in actionscript, I know flash can see the xml as I am tracing it but when I add the .text() funtion to my trace to strip out the tags by trace doesn't see anything.
    this works...
    function LoadXML(e:Event):void {
    xmlData = new XML(e.target.data);
    ParseXML(xmlData);
    function ParseXML(thexmlInput:XML):void {
    trace("XML Output");
    trace("------------------------");
    trace(thexmlInput.wrapper.page);
    this doesn't...
    function LoadXML(e:Event):void {
    xmlData = new XML(e.target.data);
    ParseXML(xmlData);
    function ParseXML(thexmlInput:XML):void {
    trace("XML Output");
    trace("------------------------");
    trace(thexmlInput.wrapper.page.text());

    The text() function returns an XMLList object, not a string literal.
    To trace out the return of XML.text() - you need to loop through the object.
    var xmlText:XMLList = myXML.text();
    for each (var i:String in xmlText){
         trace(i);
    Or you could use the toString() method instead.
    trace(myXML.toString());
    (The reason your first code works is because toString is automatically applied to trace statements, unless you specify something different)

  • Passing variable with function in AS3

    This is a function on the first frame of a .fla updated to AS3 from an old AS2 file:
    function initialize() {
    MovieClip(root).stage_target_mc.max_messages = 600;
    When the function is called it should set "max_messages" to 600 in AS3, right?
    Thanks

    Only if the function is called.  If this is going to be a set value that applies any time, then you don't need that line in a function, and if it's on the main timeline, you don't need the root reference.

  • Time line function in AS3

    How to use time line function like " gotoAndPlay, stop(), " etc with AS3,
    i had use stop in my first fram it give the error like,
    1180: Call to a possibly undefined method addFrameScript.
    did i have to import any other file for that

    Actually i wirte the simple code of generating multiple symbols on the stage in a seaprete class file, than i embed it like this:
    and then i write "stop()" in the first frame layer one.
    try yourself create any class and link it with fla and write "stop();" in first frame to stop it.

Maybe you are looking for

  • Problem with upload data from CRM to BI system

    When I try to perform full upload data from CRM to BI system with data source 0BPARTNER_ATTR (active version: Excutable). I waited for a long time but there are not any records were transfered (total records need to upload are 130) . I checked the lo

  • HT201317 Photo stream number of photos is not the same depending which device I use

    Why do I see different quantity of photos from different devices when I go to my photo stream? From my iPhone i see ~618, while from my ipad I see less than that (~570) Thanks

  • Localization strings not showing up in some components: buttons, form headings, menu bars, etc

    Hi, I've set up an application that works fine and I just localized it: english and chinese. I've set up the compiling preferences, created the properties files and loaded them into my components with fx:Metatag. Then I assigned the following to all

  • Row-level security tied to a user account.

    Bear with me, I'm not quite sure I know what I'm talking about. Recently we migrated from BO 5.1.7 to BO XII r2 on Solaris. Under Bo 5.1.7 our Finance users tell me there was a way to attach row level security to the account itself. For example, Fina

  • SMQ2 contain many entries.

    Hello All, We are facing problem with Queue processing. SMQ2 contain many entries around 122500, entires are processing very slow. We need find out the where the problem exist. Configuration details. ERP 6.0 / NW7.01 Data base  ORACLE --10.2.0.4.0 OS