Help! retrieve data hitTestPoint as a matrix, or a list? or similar

Hello, all you Flash programmers. I'm kinda a noob, sorry, but have a problem quite complex. May see a resolution in my mind, I'm fighting to create a script to solve.

Good enough I made a small application flash for a project in College, so I have a tree that this beats little creates Earth on.

I drew the tree as an MC and then use hitTestPoint function to check the weather from the central point of each character of the bat is in contact with the tree. If so land... blah blah is fairly simple.

Except that I need to create a function that generates these characters on the tree actually randomly. So to do this I would ideally have a get function that collects all the x and is pointing on the and stores that data in a list.

Then I could randomly choose one value of this character in list and hobnobbing with the x and y.

If anyone has a resolution please let me know.

Thanks in advance!

Video-based, precision is not a very big concern. If this is true, random points generation is not a big problem if loop you through the number of bats and generate random points based on the position and the dimensions of the tree.

In addition, beats being a class, I think it's more effective to have a public property, for example, landingPoint:Point in this category - that way you can read out of each instance of bat when you browse the bats to find hitTarget.

For example, if the class name is Bat and treeis the name of the graph of the tree:

var numBats:int = 100;var bats:Array = [];var bat:Bat;for(var i:int = 0; i < numBats; i++) {     bat = new Bat();     bat.landingPoint = new Point(tree.x + Math.random() * tree.width, tree.y + Math.random() * tree.height);     bats.push(bat);}

But if the accuracy is a concern, one of the ways would be to make the tree BitmapData and read (getPixel32() or getPixel()) pixels that are not transparent (or have some color) in a table, then random thing to do with bats based on this table of non-transparent pixels. The following code can work - he draws the bitmapdata without transparency, so converts the transparent pixels in black color and reads only the pixels that are not black. There may be bugs but it is for you to understand.

var treeBMD:BitmapData = new BitmapData(tree.width, tree.height, false, 0x000000);treeBMD.draw(tree);var h:int = 0;for (var w:int = 0; w < tree.width; w++) {     for (h = 0; h < tree.height; h++) {          if (treeBMD.getPixel(w, y) > 0x000000) {               bat.landingPoint = new Point(w, h);          }     }}

Post edited by: Andrei1

Tags: Adobe Animate

Similar Questions

  • With the help of the socket object to retrieve data from web application without the html files

    I tried to use the socket object to retrieve data from a web application (I just control script version vs version online). So all I want to do is access http://hyle.io/version that returns me the current version of the application (such as a simple string) in order to compare it in my script and then notifies the user accordingly. I have just a few problems using the socket object. I used this code from the Adobe Javascript Tools Guide:


    reply = "";
    conn = new Socket;
    // access Adobe’s home page
    if (conn.open ("www.adobe.com:80")) {
    // send a HTTP GET request
    conn.write ("GET /index.html HTTP/1.0\n\n");
    // and read the server’s reply
    reply = conn.read(999999);
    conn.close();
    }
    

    ... that I then adapted as:

    reply = "";
    conn = new Socket;
    if (conn.open ("hyle.io:80")) {
      conn.write ("GET /version HTTP/1.0\n\n");
      reply = conn.read(999999); 
      conn.close();
    }
    

    And here is what I get:

    HTTP/1.1 400 Bad Request
    Content-Length: 225
    Content-Type: text/html
    Server: Pagodabox-Routing-Mesh
    
    

    Bad Request

    Your browser sent a request that this server could not understand.

    Résultat : true

    I don't know a lot about HTTP requests, but I wondered if it was related to the fact that I am not pointing to a specific HTML file and the type of request was wrong or if I should rather check if there is something wrong with my host?

    The site/app is PHP and is hosted on PagodaBox if it helps.

    Thanks in advance!

    Hi Sebastien Lavoie,

    It should work

    var HTTPFile = function (url, port) {}

    If (arguments.length == 1) {}

    URL = arguments [0];

    port = 80;

    };

    This.url = url;

    This.port = port;

    this.httpPrefix = this.url.match(/http:\/\//);

    This.Domain = this.httpPrefix is nothing? This.URL.Split("/") [0] + ":" + this.port: this .url .split ("/") [2] +":" + this.port;

    This.Call = ' GET ' + (this.httpPrefix == null? ' "). " http://" (+ this.url: this.url) + "HTTP/1.0\r\nHost: ' + (this.httpPrefix is nothing? "This.URL.Split("/ ") [0]: this .url .split (" / ") [2]) +" \r\nConnection: close\r\n\r\n ";

    This.Reply = new String();

    This.Conn = new Socket();

    This.Conn.Encoding = "binary";

    HTTPFile.prototype.getFile = {function (f)}

    var typeMatch = this.url.match(/(\.) (\w{3,4}\b)/g);

    If (this.conn.open (this.domain, "binary")) {}

    This.Conn.Write (this.) Call);

    This.Reply = this.conn.read (9999999999);

    This.Conn.Close ();

    } else {}

    This.Reply = "";

    }

    (Return this.reply.substr(this.reply.indexOf("\r\n\r\n")+4);

    };

    }

    Hyle var = new HTTPFile ("http://hyle.io/version");

    Alert (hyle. GetFile());

    And by the way, I like the idea of 'http://hyle.io'. Can you give me your email address, I want to learn more about this Web site.

    Please send me an email to [email protected]

  • mobile phone - retrieve data

    How can I retrieve data from my DEAD PHONE so that I can install it on my new phone. the old man is NOT a smartphone, but it is currently connected to my computer via USB

    Hello

    I suggest that you contact the Support Section of the manufacturer of the Mobile phone and ask for their help to recover the data from their phone 'dead '.

    See you soon.

  • Retrieve data from AddressBook for Webworks Smartphone

    Hi all
    I want to implement the address book API. Where can I get/retrieve data (phone number, address of E-mail etc) for my Application project.
    Is it possible to invoke the address book to recover data?

    I go through this link, but it did not help me https://developer.blackberry.com/html5/apis/blackberry.invoke.addressbookarguments.html#view

    I have searched several times but could not get a code to make it possible.
    Please help me if someone know the solution or have any sample code.

    Thank you best regards &,.
    Castillo

    Its seems quite surprising that no member of this forum suggests even a single code related to this problem...

    However, I still have more research and find the alternative.

    var contactResult = new Array();
    
    var Fname = new blackberry.find.FilterExpression("firstName", "!=", "");
    
        contactResult = blackberry.pim.Contact.find(Fname);
        for ( var i = 0; i < contactResult.length; i++) {
            var totalName = contactResult[i].title+ " "+ contactResult[i].firstName+ " "+ contactResult[i].lastName;
            }
    

    This will retrieve all data or contacts from the address book. For which I have to do a custom address book.

  • create the http client to retrieve data from web service

    Hello

    I am newbie on our webworks. I need to retrieve data from web service. How to connect to this service and analyzed. There is a tutorial that can help me get started with it.

    Can any one advice me how can I start working with webworks on blackberry 10

    Thanks for any help

    In general, you will need to use an AJAX call to the server

    It really depends on what the server returns as to how the information is easy to digest

    JQuery provides a simple interface, and returns information easy to use

    If you deal with things gets complicated XML according to namespace

    If you look at the raw XML data and it goes something like fred: name you will have questions requiring an implementation of SAX - JSON is simple if you don't get that even if (nothing too confusing here)

    If using an external data source JSON go if you have the choice

    As examples go - just look to the top of JQuery Ajax [JSON / XML] and you will get where you're going quickly

    SAX is MUCH harder because of the namespace - Dublin is the most common and same XML without namespace is not simple to handle, so avoid it if you can

  • SQL Query to retrieve data in XML format with several levels

    Hello

    I'm looking to help generate XML from Oracle database. The request must contain many levels of sub...

    For example.
    Create table inventory
    (Group varchar2 (10))
    category varchar2 (10),
    ProductName varchar2 (10),
    Detail varchar2 (10));

    The output should be also present below. The data must be multiple values for each item.

    < inventory >
    < name of group 'auto' = >
    < category name 'cars' = >
    < name productname = 'Seat' >
    < details > red color < / details >
    < details > 5 seats < / details >
    < / productname >
    < / category >
    < / Group >
    < / inventory >

    Please share your ideas by retrieving data in the XML structure using SQL or PL/SQL for oracle 10 g.

    Thank you and best regards,
    Siva.

    This?

    SQL> create table t as
    with t as (
     select 'automobiles' "GROUP", 'cars' category, 'seat' productname, 'color red' details from dual union all
     select 'automobiles', 'cars', 'seat', '5 seats' from dual union all
     select 'automobiles', 'cars', 'make', 'ford' from dual union all
     select 'automobiles', 'cars', 'make', 'Toyota' from dual union all
     select 'automobiles', 'Bus', 'Model', 'volvo' from dual union all
     select 'automobiles', 'flight', 'Airbus', '400 passenger' from dual union all
     select 'automobiles', 'flight', 'Airbus', '500 mph' from dual union all
     select 'HealthCare', 'Nutrition', 'centrum', 'Organic' from dual union all
     select 'HealthCare', 'Nutrition', 'centrum', 'Chemical' from dual union all
     select 'Computers', 'Software', 'Database', 'Oracle' from dual union all
     select 'Computers', 'Software', 'Database', 'sqlserver' from dual
    )
    select * from t
    /
    Createtable successfully completed.
    
    SQL> select xmlserialize (content x.column_value indent) xml
      from xmltable('element Inventory
                     {for $g in distinct-values(ora:view("t")/ROW/GROUP)
                       return element group
                          {attribute name {$g},
                            for $c in distinct-values(ora:view("t")/ROW[GROUP=$g]/CATEGORY)
                              return element category {attribute name {$c},
                                for $p in distinct-values(ora:view("t")/ROW[GROUP=$g and CATEGORY=$c]/PRODUCTNAME)
                                  return element productname {attribute name {$p},
                                    for $d in distinct-values(ora:view("t")/ROW[GROUP=$g and CATEGORY=$c and PRODUCTNAME=$p]/DETAILS)
                                      return element details {$d}
                                                             }
                                                      }
                          }
                     }') x
    /
    XML
    --------------------------------------------------------------------------------
    
      
        
          
            
    Oracle
    sqlserver
    Chemical
    Organic
    volvo
    Toyota
    ford
    5 seats
    color red
    400 passenger
    500 mph
    1 row selected.
  • Retrieve data after a certain line

    Hi guys,.

    Any advice or assistance would be appreciated

    Question: How do I retrieve data after a certain line of a string of delimited by commas that are read from a port series?

    More info: to have a map which includes data values and can be read in the computer via a serial port. Example of a string of acquired data as below:

    Data = 1 bit/s = sensor tool
    ; Label, time, voltage, pressure, temperature, current
    A, 01:33, 5.1, 18.1, 31.2, -.
    B, 01:34, 5.5, 19.2, 30.5, -.
    Data = 1 bit/s = sensor tool
    ; Label, time, voltage, pressure, temperature, current
    A, 01:35, 5.3, 18.3, 30.1, -.
    B, 01:36, 5.1, 19.0, 30.5, -.

    Data = 1 bit/s = sensor tool
    ; Label, time, voltage, pressure, temperature, current
    A, 01:37, 5.1, 18.1, 30.8, -.
    B, 01:38, 5.3, 19.2, 30.1, -.

    The value of these data is kept up-to-date line by line. I would like to start to extract data only on the 3rd block of incoming data. I would not that the first 2 blocks incoming data.

    More info: currently, my idea to do this is to analyse the '; '. data"and put it in a counter. If there are 2 '; data' scanner, then woud counter set to True in a case to start structure to extract the output data. Please see my attached picture.

    However, I'm not able to create also a counter using a table that I can't use a while loop and register shift. You have an idea? Thank you very much.

    Hi pokerprof,

    If you plan to get the data individually, have you tried the following:

    Put the output of the select.vi (where it is used as part of the counter) to a comparison so that when we tell: counter-online 3, begin to extract.

    Alternatively, you can use the below:

    The number of iterations that you plan to run? My concern would be the overflow of integer of the meter (http://en.wikipedia.org/wiki/Integer_overflow).

    You can try like vi, illustrated by johnsold (if you get all the data in a single iteration).

    Thank you

    Warm greetings,

    Lennard.C

  • Print data LabVIEW using the MATRIX printer?

    How to program in LabVIEW such as some data may be printed matrix printer?

    p/s: the matrix printer (EPSON TM - U220) is connected to the computer via a serial port.

    I thank very you much for the replies...

    =)

    I found the solution.

    the pre-selection of the printer matrix printer dafault and use an icon in LabVIEW called - will report in simple text format.

    =) Thank you very much for your answer!

  • to retrieve data from xml data type

    Hello...
    I have a doubt in the oracle database... Here's how to retrieve data from xml data type?

    Like this...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select xmltype('
      2  
    3 4 toMonth5 5 ctTestPan1 6 costType2 7 toYear2012 8 fromMonth12 9 fromYear2011 10 11
    ') as xml from dual) 12 -- 13 -- end of sample XMLDATA, use below query on your own table etc. as required 14 -- 15 select x.* 16 from t 17 ,xmltable('/DETAILS/FIELDS_VALUES/FIELD' 18 passing t.xml 19 columns name varchar2(30) path './NAME' 20 ,val varchar2(10) path './VALUE' 21* ) x SQL> / NAME VAL ------------------------------ ---------- toMonth 5 ctTestPan 1 costType 2 toYear 2012 fromMonth 12 fromYear 2011 6 rows selected.
  • Get a delta.vmdk to retrieve data

    Hi all

    I'm looking for a way to recover data on a delta.vmdk file I have. Basically what happened last week, it's a virtual machine has whipped out and I had to restore some files I had saved manually. I had all the shots or delta.vmdk files, but I was able to restore the data on the file - flat.vmdk. I finished due to lack of 20gigs of data, but I have the delta.vmdk file (20 GB) that I want to retrieve data from. I also have the most recent snapshot file manually before the disaster. What I read, there is a way to create a new virtual machine, the Assembly of the delta.vmdk (20 GB) as a new hard drive and then just manually copy files and folders off the power. How can I accomplish this?

    Thank you!!

    Well it seems that you are missing two snapshots of the chain. However, I have prepared the attached template for the snapshot file because it is missing (at least you haven't added it in the zip file).

    Add the file descriptor to the file of the virtual machine, and then create a clone of the disc

    The command to clone the drive is like:

    vmkfstools-i /vmfs/volumes/old_datastore/vmdir/vm-00003.vmdk /vmfs/volumes/new_datastore/recover/vm-clone.vmdk

    BTW: Have you tried different things with the VM already? The virtual machine refers to a ' ps - delta.vmdk "as the file to HARD drive?

    André

    Ref: http://kb.vmware.com/kb/1007849

  • Flex 4.5 allows multiple components of the page retrieve data in parallel?

    There are frameworks that allow several components of the page to go in parallel with multi threading. Framework of the new Flex 4.5 allows that several components of the page retrieve data in parallel? Because I think that there is no other framework that allows that several components of the page retrieve data in parallel.

    Needs of light on it. Thank you.

    If you mean, it allows you to perform several Web service calls at the same time (asynchronous), then the answer is Yes.  If you need complete a component that is located on another page before the user this page is displayed, you can use this:

    
    

    creationPolicy = "all" create the component before the user saw, so that you can use these components programmatically.

  • retrieve data from staging account

    Hello

    does anyone know how we can retrieve data from staging of account using 'Segmentation Wizard', "report analysis tool", model of fusion and mailing, etc.?

    Seems that these tools connect only to the production instance...

    Thanks, Sab

    SAB,

    for segmentation Wizard (and perhaps other office files), you will have to go file - properties - Custom and update the values for the name of pod, if you have a job you know what value it is as I am not "have a practice to watch.

    see you soon
    Alex

  • Unable to retrieve data from apex objects on certain areas... strage error bug?

    I have a form with a list of different selection...
    I use dynamic action for validation... Here's the code...

    The strange part is mtest we see the following result...

    --------------------------------------------------------------------------------
    claudecocoviloin
    xxx1095226
    xxx

    SQL > spool off

    There is data in the other fields in the list... which included official address 2... and start the problem...
    These data are not picked by the code... But as the field data: P185_SUBSCRIBE_nO is visible i.e. 1095226.
    Why the apex behave this way... Is it a bug pls confirm...
    I use apex 4.02 in 11 g xe...

    DECLARE
    MSI number (10);
    BEGIN
    MSI: = 0;

    SELECT orginal_date FROM MSI of SUBSCRIBERS WHERE SUBSCRIBE_NO =: P185_SUBSCRIBE_nO;
    insert into mtest values ("claudecocoviloin" |: P185_start_issue);
    insert into mtest values ("xxx" |: P185_SUBSCRIBE_nO);
    insert into mtest values ("xxx" |: p185_off_address2);
    IF to_number(:p185_start_issue) < = 100 THEN
    insertion in mtest values ("enter dragong");
    raise_application_error (-20290, ' will raise error isue the problem');
    on the other
    null;

    END IF;

    END;

    Published by: pauljohny on January 3, 2012 20:37

    Paul

    If you are - you by using a dynamic type "running PL/SQL" action then you are already using AJAX. And it sounds to me that you are from the code you posted is PL/SQL.

    One of the parameters to this dynamic action is Put "Page to go" here all elements on the page that you use in you are PL/SQL code. As the name already suggests these will be submitted and there the value in session state.

    Nicolette

  • Retrieve data from a Web site by running a python script to help schedule a task

    I'm under Calendar (task name - extracted) to retrieve the data every 5 minutes of a wesbsite of transport to verify respect of accidents by running a python file (incident.py) and back into a json (incident.json) file.

    When I tried to run the task on the calendar, the json file did not appear.

    Codes to print the result to a json file:

    #Parse JSON to print
    jsonObj = json.loads (content)
    print json.dumps (jsonObj, indent = 4, sort_keys = True)

    #Save result to file
    with open ("c:/Incident.json", "w") as outfile: #Saving jsonObj ["d"]
    JSON.dump (jsonObj, outfile, sort_keys = True, indent = 4, ensure_ascii = False)
    Python - JSON file (result) incident.py - incident.json

    Can anyone help?

    This issue is beyond the scope of this site (for consumers) and to be sure, you get the best (and fastest) reply, we have to ask either on Technet (for IT Pro) or MSDN (for developers)

    If you give us a link to the new thread we can point to some resources it
  • Help me with SQL Query to retrieve data from a view

    Hello Guru,

    I need help in my sql query.
    I use SQL TeraData.
    I want an Oracle result in the following form-

    Open tickets
    Open months failure / Repair Service s/o improvement request Total general
    2009-01-2 4 4 5 15
    2009-02 1 0 2 3 6
    2009-03 4 1 2 2 9
    Grand Total 7 5 8 10 30


    I wrote the query as where - TIME_PERIOD, RQST_TYPE_DM and DEMAND_SUMMARY_FCT are the points of view and I extract the data from the views only.

    Select NVL (CA. TIME_PERIOD. PERIOD_CD, 'Total') THAT year.
    COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC Like '% of Break' THEN 1 END) as BreakFix
    COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC as 'N/a', 1 END) by n/a
    COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC as 'Improvement' THEN 1 END) accessories
    COUNT (CASE WHEN CA. RQST_TYPE_DM. RQSTTYP_DESC Like '% Service' THEN 1 END) as ServiceRequests
    COUNT (CA. RQST_TYPE_DM. RQSTTYP_DESC) AS grand_total
    FROM CA. TIME_PERIOD, CA. RQST_TYPE_DM, CA. DEMAND_SUMMARY_FCT
    WHERE (CA. DEMAND_SUMMARY_FCT. RQSTTYP_ID = CA. RQST_TYPE_DM. RQSTTYP_ID)
    AND (CASE
    WHEN CA. DEMAND_SUMMARY_FCT. MONTH_ID = CA. TIME_PERIOD. PERIOD_ID, 1
    WHEN {fn concat ({fn concat (SUBSTR (CA. TIME_PERIOD. {(PERIOD_CD, 3, 4),'-')}, SUBSTR (CA. TIME_PERIOD. PERIOD_CD, 7, 2))} BETWEEN ' 2009-01' AND ' 2009-03' THEN 1
    WHEN CA. DEMAND_SUMMARY_FCT. RQSTTYP_ID = '1' then 1
    END) = 1
    GROUP BY ROLLUP (CA. TIME_PERIOD. PERIOD_CD)

    After executing the query, I get the following error:
    3076: syntax Error: Data Type 'Time' does not match a defined Type name.
    :( Kindly help me with this and let me know where I'm wrong... Please.

    Messages indicates something wrong with your data... It would seem that the data does not match your format mask.

    Thus, the data or the format mask.

Maybe you are looking for