How to Pass a String as a MovieClip Name?

Hi everyone! I'm back with more doubts
I created 4  buttons with 4 animations each, one for each state (using tweens), so I  have that imense list of 16 "addEventListeners" (don't know if there's  another way to do it). But everything is working as I would like.
The  problem is that I'm trying to create only 4 functions to take care of  all the 4 buttons and those 16 eventListeners.
This is  part of my AS3 file (still with the "traces", 5 secs of animation to  check the animations and all).
empresa_btn.addEventListener(MouseEvent.MOUSE_OVER, isOver);
empresa_btn.addEventListener(MouseEvent.MOUSE_OUT, isOut);
empresa_btn.addEventListener(MouseEvent.MOUSE_DOWN, isDown);
empresa_btn.addEventListener(MouseEvent.MOUSE_UP, isUp);
parceiros_btn.addEventListener(MouseEvent.MOUSE_OVER, isOver);
parceiros_btn.addEventListener(MouseEvent.MOUSE_OUT, isOut);
parceiros_btn.addEventListener(MouseEvent.MOUSE_DOWN, isDown);
parceiros_btn.addEventListener(MouseEvent.MOUSE_UP, isUp);
var mouseState:String;
var mouseActive:String;
var txt:String;
empresa_btn.over.alpha = 0; empresa_btn.down.alpha = 0;
parceiros_btn.over.alpha = 0; parceiros_btn.down.alpha = 0;
function isOver (e:MouseEvent):void {
     mouseActive = e.currentTarget.name;
     mouseState = "isOver";
     trace (mouseActive + " " + mouseState);
     var isOver:Tween = new Tween(empresa_btn.over, "alpha", Strong.easeOut, empresa_btn.over.alpha, 1, 5, true);
function isOut (e:MouseEvent):void {
     mouseActive = e.currentTarget.name;
     mouseState = "isOut";
     trace (mouseActive + " " + mouseState);
     var isOut:Tween = new Tween(empresa_btn.over, "alpha", Strong.easeOut, empresa_btn.over.alpha, 0, 5, true);
Now, what I'm trying to do is use the var "mouseActive"  that is returning the right button names inside the Tween as the  movieClips.
The problem is that "e.currentTarget.name" is not the  "movieClip" itself... it's just a String with the name of the movieClip.
Example:  whenever I try to do something like this:
var isOut:Tween = new Tween(mouseActive.over, "alpha", Strong.easeOut, mouseActive.over.alpha, 0, 5, true);
It will return an error cause, as I said, mouseActive is not a  movieClip, it's just a String (at least I think).
I already  thank you for the help (again)
And please, mind my nickname

Ned Murphy wrote:
You're welcome.
As a further opportunity to reduce code, since all your listeners are identical...
var btnArray:Array = new Array(btnNames go here, no quotes);
for(var i:uint=0; i<btnArray.length; i++){
     btnArray[i].addEventListener(...OVER...);
     btnArray[i].addEventListener(...OUT...);
     etc... including where you set alpha = 0
Gosh Ned! I had about 25 big lines of code, including things like "buttonMode = true" and now I have less than 10
This is totally crazy! I always tried to understand this array thing and always failed. It's complicated but your code made some sense after a while
I'm running out of "thanks" to give you hehe. Everything is working just fine but one little thing. I have a sound that plays when a button is clicked. It's working fine but everytime I open the swf the sound autoplay once =/
I'm using this code:
var btnSound:Sound = new clickSound(); //"clickSound" is the className I choosed when exported the sound to AS from the library
and then, inside the function MOUSE_DOWN I have:
btnSound.play();
Everything is working but I always hear the button sound playing one time when I open the swf. Do you know why?
Well, you already helped me a lot. Even more that I could have asked for.
Thanks!

Similar Messages

  • How to pass a String and make it as Color Object

    I need to set a background color dynamically...but the value that i pass is in string format. How can i convert the string into Color format so that i can use the method setBackground(Color.blue) method. How to pass the string into the 'Color.blue' ?

    Let param="red"
    Class cls = Class.forName("java.awt.Color");
    java.lang.reflect.Field fld = cls.getDeclaredField(param);
    Color clr = (Color)fld.get(null);
    You can use this 'clr' variable as you wish.
    null

  • How to pass a string value from XL sheet cell to SQL query.

    Hi,
    I am using SQL query in XL sheet to fetch some data. for that i am using ODBC connection. Now I want to pass a string from XL sheet Cell value in the where clause of Select statement, Please let me know how to do this.
    Below is My code:
    nge("A4").Select
    With ActiveSheet.QueryTables.Add(Connection:= _
    "ODBC;DRIVER={Microsoft ODBC for Oracle};UID=xyz;PWD=xyz;SERVER=xyz;" _
    , Destination:=Range("A4"))
    .CommandText = Array( _
    "SELECT CRYSTAL_REPORT1.PROJECT, CRYSTAL_REPORT1.OBJECT" & Chr(13) & "" & Chr(10) & "FROM NAIODEV.CRYSTAL_REPORT1 CRYSTAL_REPORT1" _
    .Name = "Query from gg"
    Thanks,
    Priya

    What does "XL" (whatever that is) have to do with Crystal Reports which is what you are obviously working with have to do with the Oracle database?
    The rules for using Crystal with Oracle are quite clearly described in all the Crystal Reports docs ... you MUST use IN OUT ref cursors unless you are doing direct table or view access.

  • How to pass a string longer than 30 to an Export Parameter in a PI sheet ?

    Hi All,
    I'm trying to set  up a process instruction in a PI sheet that calls a URL web page.
    I found the function module CALL_BROWSER and tested it in SE37 and it works fine.
    I created a process instruction to call this function module and pass parameters to it.
    Everything works if the URL is short.  For example:
    0010   PPPI_BUTTON_TEXT          Show URL
    0020   PPPI_FUNCTION_NAME          CALL_BROWSER
    0030   PPPI_FUNCTION_DURING_DISPLAY     allowed
    0040   PPPI_EXPORT_PARAMETER          URL
    0075   PPPI_STRING_CONSTANT          http://www.google.com
    This is where I ran into a roadblock. 
    The characteristic PPPI_STRING_CONSTANT is only 30 characters long.
    I can't figure out how to pass an export parameter longer than 30 characters.
    I have also tried loading up multiple PPPI_VARIABLE(s) with the idea of some how combining them into a single long string that I can pass, but no luck figuring out how.
    Any help would be greatly appreciated
    Kind Regards
    Michael

    Thanks Dario, this is good information, but it does not directly solve my problem.
    I think I have figured out an approach, but was hopeing someone else had a standard solution.
    If I don't here something soon, I will try the following:
    Create a new function moduel as a shell or wrapper that calls the standard FM RUN_Browser.
    My shell will have 5 input parameters URLP1 thru URLP5.
    I can then pass a long URL to my shell in 5 parts.
    Inside my shell, the 5 parts will be joined up into 1 long string and passed on to the URL parameter in RUN_Browser.
    If anyone has a better idea, please let me know.
    Kind Regards
    Mike Rupp

  • ISQL*PLUS dynamic reports - how to pass connect string in the URL

    When we run dynamic reports thru ISQL*PLUS, does anyone know how
    to pass the connect string info in the URL
    The following is the code from ISQL*PLUS users guide but it
    dosen't show how to pass the connect string
    when I tried to pass hr/your_secret_password@dbserver for userid
    I got an error msg
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    <HTML>
    <HEAD>
    <TITLE>iSQL*Plus Dynamic Report</TITLE>
    </HEAD>
    <BODY>
    <H1>iSQL*Plus Report</H1>
    <H2>Query by Employee ID</H2>
    <FORM METHOD=get ACTION="http://host.domain/isqlplus">
    <INPUT TYPE="hidden" NAME="userid"
    VALUE="hr/your_secret_password">
    <INPUT TYPE="hidden" NAME="script"
    VALUE="http://host.domain/employee_id.sql">
    Enter employee identification number: <INPUT TYPE="text"
    NAME="eid" SIZE="10">
    <INPUT TYPE="submit" VALUE="Run Report">
    </FORM>
    </BODY>
    </HTML>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Thanks
    Jay

    The form you use should work when your change
    "hr/your_secret_password" to a valid username, password
    and connect identifier like "hr/hr@MYDB". Don't forget to
    configure MYDB in your tnsnames.ora file on the machine that has
    the iSQL*Plus server.
    What was the error you got?
    The full URL syntax did seem to go missing from the 9.0.1 doc.
    See below for the full syntax. This should be appearing in a
    forthcoming FAQ.
    - CJ
    What syntax can I use to run an iSQL*Plus Dynamic Report?
    You can run a dynamic report by entering the report URI in the
    location field of your browser, or by making the report server a
    link or the action for an HTML form. The iSQL*Plus 9i Release 1
    documentation has examples of these.
    The general syntax for running a dynamic report is:
    {uri}?[userid=logon&]script=location[&param...]
    where uri
    Represents the Uniform Resource Identifier (URI)
    of the iSQL*Plus Server, for example:
    http://host.domain/isqlplus
    where logon
    Represents the log in to the database to which you
    want to connect:
    {username[/password][@connect_identifier]}
    where location
    Represents the URI of the script you want to run.
    The syntax is:
    http://[host.domain/script_name]
    The host serving the script does not have to be
    the same as the machine running the iSQL*Plus server.
    where param
    Specifies the named parameters for the script you
    want to run.
    Named parameters consist of varname=value pairs.
    iSQL*Plus will define the variable varname to equal value prior
    to executing the script e.g.
    ...script=http://server/s1.sql&var1=hello&var2=world
    This is equivalent to the SQL*Plus commands:
    SQL> define var1=hello
    SQL> define var2=world
    SQL> @http://server/s1.sql
    iSQL*Plus, SQL*Plus and SQL keywords are reserved
    and must not be used as the variable names (varname). Note also,
    that since variables are delimited by the ampersand character,
    there is no requirement to enclose space delimited values with
    quotes. However, to embed the ampersand character itself in the
    value, it will be necessary to use quotes.
    For compatibility with older scripts using the &1
    variable syntax, varname may be replaced with the equivalent
    variable position as in:
    ...script=http://server/s1.sql&1=hello&2=world
    Note the & is the URL parameter separator and not
    related to the script's substitution variable syntax.
    Commands and script parameters may be given in any
    order in the dynamic report URI. However, please note that if any
    parameters begin with reserved keywords such as "script" or
    "userid" then it may be interpreted as a command rather than a
    literal parameter.

  • Is it possible to pass a string representing a class name in java as an arg

    Hi, this is probably a bit of a stupid question, but one that has me quite confused all the same!
    Is it possible to pass a string or class name etc. representing a type of class in java, to a method so that instead of having to redefine a method with say the following args:
    public SolarPanels[] bestPVPanels(int budget, int percent) {
            HashMap<Integer, SolarPanels> panelsMap    = new HashMap<Integer, SolarPanels>();
    }As at present needing to create a methods bestWindTurbine() and many others exactly the same, but for the type, I would instead like to be able to create a method like:
    public Object[] bestRenewable(int budget, int percent, String aClassName) {
            HashMap<Integer, aClassName > renewableMap    = new HashMap<Integer, aClassName >();
    }But cant sus how to do this as passing a String is off course going to cause problems unless its it possible to cast a string to a class name, any help or advance would be much appreciated.
    Thanks in advance
    Pat Nevin

    pNev wrote:
    But cant sus how to do this as passing a String is off course going to cause problems unless its it possible to cast a string to a class nameIt's not. You can do things like
    Class.forName(classNameInString);But that will only return a Class object.
    And as Java generics are erased at runtime, passing the class name to the method is useless as it is too late to use it anyways.
    Ah, Peter's way is what I was thinking of. Too early in the morning.
    Edited by: Kayaman on 23.6.2010 10:02

  • How to pass a string variable in a single quote

    Hi,
    I am trying to pass a single quoted string, 'some string', into a concat expression.
    My situation is some thing like
    I have an array of states
    <copy>
    <from>
    <ListOfValues xmlns="http://tbone.coi.test/amis">
    <!-- State -->
    <Value>A</Value>
    <Value>B</Value>
    <Value>C</Value>
    </ListOfValues></from>
    <to variable="StateList"/>
    </copy>
    then I loop through the StateList array to get each state as
    <copy>
    <from variable="StateList" query="/tns:ListOfValues/tns:Value[bpws:getVariableData('iterator')]"></from>
    <to variable="currentState"/>
    </copy>
    I then build an xpath expression like:
    <copy>
    <from expression="concat('/nsxml0:GetSummariesResponse/nsxml1:Summaries[nsxml1:State = ',bpws:getVariableData('currentState'), ']')"></from>
    <to variable="xpath"/>
    </copy>
    As the result, my xpath look like:
    /nsxml0:GetSummariesResponse/nsxml1:Summaries[nsxml1:State = A]
    but I need a state surrounded by single quote as 'A' or xpath query like
    /nsxml0:GetSummariesResponse/nsxml1:Summaries[nsxml1:State = 'A']
    Any ideas how can I single quote a value of bpws:getVariableData('currentState') in my concat expression
    Thanks,
    -V

    Have you tried 'the string contain''s an &apos;'?

  • How to pass a string varaible to an internal table field

    Hi Experts,
    I am reading notes/text entries by calling read_text and then passing them in a variable. I want to display the notes. But even after declaring the variable as  LINE2048, it is displaying only 255characters as output length.
    My code:
    TYPES: BEGIN OF TYP_FINAL,
             PARTNER_NO      TYPE BU_PARTNER,         "Partner No.
            OBJECT_ID       TYPE CRMT_OBJECT_ID_DB,  "Object ID
            PROCESS_TYPE    TYPE CRMT_PROCESS_TYPE,  "Activity Type
           ACTUAL_NOTE     TYPE LINE2048,           "Actual Notes
           END OF TYP_FINAL.
    data : T_FINAL           TYPE STANDARD TABLE OF TYP_FINAL,
              WA_FINAL          TYPE TYP_FINAL.
    data:  v_actualnote     TYPE LINE2048.
              CALL FUNCTION 'READ_TEXT'
                EXPORTING
                 CLIENT                        = SY-MANDT
                  ID                            = C_0002
                  LANGUAGE                      = sy-langu
                  NAME                          = l_name1
                  OBJECT                        = C_BUT000
                TABLES
                  LINES                         = t_line
               EXCEPTIONS
                 ID                            = 1
                 LANGUAGE                      = 2
              IF SY-SUBRC = 0.
               clear: v_accountnote.
               LOOP AT T_LINE INTO WA_LINE.
                 CONCATENATE v_accountnote wa_line INTO v_accountnote SEPARATED BY space.
                 clear: wa_line.
               ENDLOOP.
              wa_final-account_note = v_accountnote.
              clear: v_accountnote.
             ENDIF.
    So, if I make the v_actualnote as string and pass it to a string variable, that should work.
    But the system is not allowing me to declare a string varaible inside the internal table.
    Please let me know how to display more than 255 characters in v_accountnote  .
    Regards,
    Sangeeta.

    you are passng that as a string = '5,6' does not exist
    try this : http://www.mssqltips.com/sqlservertip/1771/splitting-delimited-strings-using-xml-in-sql-server/
    declare @table table(sno int)
    insert into @table values(5),(6)
    DECLARE @xml as xml,@txtSchedule as varchar(100),@delimiter as varchar(10)
    SET @txtSchedule='5,6'
    SET @xml = cast(('<X>'+replace(@txtSchedule,',','</X><X>')+'</X>') as xml)
    select * from @table WHERE sno IN ( select N.value('.', 'varchar(10)') as value FROM @xml.nodes('X') as T(N))
    Hope it Helps!!

  • How to pass a string from a child thread to a parent thread ?

    I have a Server class listening to a particular port continuously using TCP Sockets . Whenever a client connects to this server socket, a new thread is created to obtain the data from the client socket. The following code shows how this is done -
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.*;
    public class TransportHandler extends Thread{
              ServerSocket server_socket;
              int myListeningPort;
              public String clientReq = "";
              public TransportHandler() throws IOException{
                   super();
                   myListeningPort = 80;
                   CreateServSocket();
              //throw the socket exception outside, so that it can be handled
              public TransportHandler(int port) throws IOException{
                   super();
                   myListeningPort = port;          
                   CreateServSocket();
              private void CreateServSocket() throws IOException{
                            //create serversocket
                   server_socket = new ServerSocket(myListeningPort);
              public void printmsg(){
                   System.out.println(clientReq);
              @Override
              public void run() {
                   // TODO Auto-generated method stub
                   StartListening();
              public void StartListening(){
                   while(true){
                        //loop forever listening to connections
                        try {
                             Socket clientSocket = server_socket.accept();
                                             //create new thread to handle client connection
                             Thread clientthread = new Thread(new ClientConnectionHandler(clientSocket));
                             clientthread.setName("Client Handler");
                             clientthread.start();
                             printmsg();
                        } catch (IOException e) {
                             // TODO Auto-generated catch block
                             e.printStackTrace();
              public void StoreReq(String msg){
                   clientReq.concat(msg);
              private class ClientConnectionHandler implements Runnable{
                   Socket ClientSock;
                   BufferedReader sockReader;
                   InputStreamReader isReader;
                   String messageFromClient;
                   public ClientConnectionHandler(Socket sock){
                        ClientSock = sock;
                        try {
                             isReader = new InputStreamReader(ClientSock.getInputStream());
                             sockReader = new BufferedReader(isReader);
                        } catch (IOException e) {
                             // TODO Auto-generated catch block
                             e.printStackTrace();
                   @Override
                   public void run() {
                        // TODO Auto-generated method stub
                        int c= 0;
                        try {
                             while( (messageFromClient = sockReader.readLine())!= null){
                                  StoreReq(messageFromClient);  
                             //System.out.println("clientreq = "+clientReq);
                        } catch (IOException e) {
                             // TODO Auto-generated catch block
                             e.printStackTrace();
    }The TransportHandler is instantiated from another class HttpMessageHandler as shown below -
    import java.io.IOException;
    public class HttpMessageHandler {
         public static void main(String[] args){
              try {
                   TransportHandler server = new TransportHandler();
                   server.start();
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    }So in the above code when the server.start() is executed, the run() method in TransportHandler is executed. How do I get the string contained in clientReq in HttpMessageHandler after the data from client socket is fully read ?
    Edited by: turing09 on Dec 12, 2009 2:13 PM

    Okay, to make my problem more clear to you - basically I am trying to create a simple Http Server, wherein the HttpMessageHandler is an interface between the Http layer & the Transport layer (represented by TransportHandler class). I am trying to code it bottom-up. In my design I require the TransportHandler class to get the client http request data from the TCP socket and pass it onto the HttpMessageHandler class.
    At the same time TransportHandler class must continuously listen to the port to receive other connections. For every client connection, the TransportHandler creates a new ClientHandler thread & this new thread gets the data. The TransportHandler instance & the ClientHandler instance are running in seperate threads. The HttpMessageHandler is running in the main thread. Please note: the member variable clientReq is private & not public
    The problem I am facing here is that even when the ClientHandler thread finishes, I am not able to print the client request data in HttpMessageHandler thread.
    I am able to print the String in the run() method of ClientHandler but not in HttpMessageHandler main() method.
    Any solutions for this?
    Edited by: turing09 on Dec 12, 2009 5:24 PM
    Edited by: turing09 on Dec 12, 2009 5:25 PM

  • How to pass a string from a servlet to client side

    hi,
    i would like to generate a string from a servlet and pass it to the client side. the client will receive the string by using request.getParameter(). How should i implement this system? Could anybody give me some hint?
    Best Regards,
    Henry

    Greetings,
    hi,
    i would like to generate a string from a servlet and
    pass it to the client side. the client will receive
    the string by using request.getParameter(). HowAre you referring to the instance of (Http)ServletRequest the 'request' object being passed to the "client"? What is the "client" in this case? If you mean a "traditional" client communicating over (or by tunneling through...) HTTP then no can do. The (Http)ServletRequest object is generated by the web container (a.k.a. "servlet engine"), not by the client, and it is not serializable so there is no way to pass it back to the client...
    should i implement this system? Could anybody give me
    some hint?It depends again on "what is the 'client' in this case?"
    Best Regards,
    HenryRegards,
    Tony "Vee Schade" Cook

  • How to pass a String as a NUMC in backwnd table

    Hi All
    I have a Backend Table with the Field name : PERNR, having Type as "NUMC"
    From portal I have got the Selcted Pernr in a form of a String. But when I am passing this to table, it gives me below error at runtime  :
    com.sap.aii.proxy.framework.core.DataAccessException: Type conversion error, field PERNR, complex type class com.abb.model.Zexigo_Pernr
    So please tell me how should I pass NUMC value from a String value.

    Hi Nikesh,
    Sorry for that.
    You can refer this link:
    /thread/1692735 [original link is broken]
    In this case, they hav used a table and trying to pass multiple pernr number.
    Regards,
    Jithin

  • How to pass query string from content editor webpart to another?

    Hi All,
    I am using content editor web-part to show GooglePiechart  for workflow status column in a list. When user click on chart, i need to show particular clicked area data in another list web-part. So that, i need to pass the query value from content editor
    web-part to another web-part. How to achieve this scenario?

    Hi Sam,
    What you can do is using SPD create a data view webpart which excepts query string value as filters as shown in the below article
    http://madanbhintade.wordpress.com/2012/01/08/sharepoint2010dataviewwebpart/
    http://sharepoint.stackexchange.com/questions/55184/how-to-filter-dataview-webpart-dvwp-from-query-string
    Then When you click on the pie charts particualr section perform a post back  by appending the required query string paramter to the same page on which your webpart exist
    Raghavendra Shanbhag | Blog: www.SharePointColumn.com
    Please click "Propose As Answer " if a post solves your problem or "Vote As Helpful" if a post has been useful to you.
    Disclaimer: This posting is provided "AS IS" with no warranties.

  • How to pass a string as a parameter after it has been generated on console

    This is wat i want to do...when a sentence has been generated on console(using Bingo.startConversation())..i want to pass this sentence(which is ofcourse string) as a parameter into another method Bingo.reply(???)..wat shud i use in the place of ???
    this is my code
    public static void main(String[] args) {
    Conversation conversation=new Conversation();
    Bingo bingo=new Bingo ();
    System.out.println("Start");
    System.out.println(">>");
    System.out.println(Bingo.startConversation());//this line generates a sentence on console//
    System.out.println(Bingo.reply(???));

    -> this is my code
    Still didn't use the "Code" tags like you've been asked to do in other postings.
    So, still no help.

  • How to pass query string parameters in list ?

    Hi,
    I have a "Links list" it contains the columns "Empname", "Description" and "Susped/resume" .Here Admin enters the records. When admin enter 'suspend' in "suspend/resume" column it will navigate to "suspend
    page" similarly if enter 'resume' it will navigate to resume page.
    So How I have to set the suspend/resume column by using query string parameter? (dont use hyperlink)
    (We are completely developing my project by using out of box  )
    Appreciate if any one help.
    Thank you.

    Hi,
    It will be easier for others to research on your requirement if you can provide more details about your requirement.
    What is the reason of not using a hyperlink field type? As with hyperlink, we can navigate to other pages easily.
    If you want to use other field type, we will need to write some code(JavaScript) to meet your requirement.
    Best Regards
    Dennis Guo
    TechNet Community Support

  • How to pass Array String to callable statement

    How can I pass an array variable to the callable statement as an out parameter and how to define that in the pl/sql procedure.
    Thanks,
    HC

    HC
    If you would refer to the link given by Anil, You can make out that there in input as well as in output it is passing an array of records.
    CallableStatement cs = conn.prepareCall("{call XX_PassTableType.XX_PassTableType_prc(:1, :2)}"); 
    ARRAY array = new ARRAY(new ArrayDescriptor("APPS.JTF_NUMBER_TABLE", conn), conn, vNumber); 
    ARRAY array1 = new ARRAY(new ArrayDescriptor("APPS.JTF_VARCHAR2_TABLE_100", conn), conn, as); 
    cs.setArray(1, array); 
    cs.setArray(2, array1); 
    cs.registerOutParameter(2, 2003, "JTF_VARCHAR2_TABLE_100");In above lines 1 is the input parameter that is an array of number while 2 is an array of varchar.
    Thanks
    AJ

Maybe you are looking for