How to make your own custom methods in AS3?

I was wondering if I could make my own method for the form.
I wrote a little function to draw a line with a square brush from one point to another point.

Now at the moment it's just a function as follows
function drawSquareLine (shpe:Shape, x 1, y1, x 2, y2, brushWidth, color) {}
with (SHPE)
{
graphics.beginFill(0xFF0000,1);
graphics.lineStyle(.25,0x000000,0);
graphics.moveTo(x1,y1);
graphics.lineTo(x2,y2);
}
}

However, I thought it would be cool if I could do as a custom method (is that the right terminology?)
So, instead of providing the form as a parameter of the function could... do call that?

shpe.drawSquareLine(x1,y1,x2,y2,brushWidth,color);

And if so could I have an example on how I could do this?

Bravo guys.

Excellent.
you explained that perfectly (and it still took me 40 minutes to understand).

So I in the outer class .as file
package {}
import flash.display.Shape;

public class lineTool extends shape
{
public void drawSquareLine(x1:int,y1:int,x2:int,y2:int,color:uint,brushSize:int)
{
var bsH:Number = brushSize/2;
graphics.beginFill (color, 1);
graphics.moveTo (x 1, y1 - bsH - bsH);
graphics.lineTo (x 1, y1 + bsH - bsH);
many lineTo etc.
graphics.endFill ();
}
}
}

and in part 1 of my movie, I

var shpe:lineTool = new lineTool();
shpe.drawSquareLine (20,20,100,100,0xFFDDBB,10);
addChild (shpe);

Thanks for the second help :)

Tags: Adobe Animate

Similar Questions

  • How to make your own Board BNC connector for 37 pins PCI-6010?

    This is first time I am doing data acquisition and the BNC-2110 present can be connected to PCI-6010. How to make a Board for it?

    I'm not sure what you mean by "some"; The BNC-2120 exposes all channels HAVE and AO on connector 0 of a standard feature of E, M or X series.

    • Eight BNC connectors are for eight differential channels of I. For example, for the BNC connector labeled 'I 0', the Center connects to the 'I 0' pine and the outside connects to pin 'HAVE 8'. (The BNC-2120 probably would not be a good choice for someone who wanted to use the channels in unbalanced mode).

    • Other two is for the analog output; the centres are ' AO 0' and 'AO 1' and transmissions are related to "AO GND".

    • There is another connector BNC for PFI 0; all other PFI (with the exception of the 10, 11 and 15) are broken down as screw terminals.

    • Other BNC connectors connect what either directly (the unit is powered by the + 5V line but otherwise works autonomously, and the "user defined signals' are connected to terminals to adjacent screws).

    It seems like it wouldn't be difficult to have a cable that was going on a PCI-6010 the 37 pins on the connector 68 pins on the BNC-2120. I'm a little curious as to why we do not have one. Possible reasons off the top of my head which may explain why not:

    • cards PFI/description would be a mistake (for example, on a series of E/M/X ' CTR 0 SRC "PFI 8; on the 6010 is PFI 0.)

    • No digital lines (E/M/x series P0.0 P0.7 via are independent; on the P0.0 6010 P0.5 and P1.0 by P1.3 are shared with PFI lines)

    • Confusion about being able to connect to other devices that we sell with connector d - SUB 37 pin, but who do not use a compatible pinout (for example, the PCI-6239, PCI-6510 or the NI 9237). Here again, a PCI-6703 also uses a 68 connector pins, but has a completely incompatible pinout as well.

    But it seems that those who would be pretty easy to deal with, because it is useful to be able to connect to the BNC-2010. Maybe it's an idea for the Exchange of ideas information Acquisition?

    Anyway, if you want to have pushed BNC for everything on your Board of homebrew will need you:

    • 8 or 16 BNC connectors to HAVE, depending on whether you want single-ended or differential. For differential, the centres are GOT by AI 7 0, and transmissions are AI by AI 15 8. For asymmetric, the centres are HAVE 0 through 15 AI and transmissions should all connect to GND AI.

    • HAVE a sense (I think that you only need this if you use channels Nonreferenced Single - Ended (NRSE). See also: noise considerations for analog signals and field wiring.)

    • Two for AO (centers are AO 0 and 1 AO, outers times connect to AO GND).

    • Ten for PFI/digital lines. Outers will connect to GND D.

    Up to a maximum of 29. You want maybe less, depending on your application.

  • BlackBerry smartphones make my own custom ringtone

    Simple question, how can I make my own custom ringtone & how can I install it on my BB Pearl 8220

    Get an mp3 file and save it on micro-sd card in your device.

    To save the mp3 file, there are two ways available: Roxio Media Manager (comes with Blackberry Desktop Manager with Media Manager) and when to use your Blackberry as a USB device.

    I recommend the second way.

    Transfer your mp3 ringtones folder on your micro-sd card file.

    After that, the mp3 file will be available to set as a ringtone custom to a contact in address book.

  • Make your own type of plan

    This is done just for the folks at Adobe, I wanted to you guys an email directly, but apparently there is no email address to...

    I didn't need all the apps available for $50 / month

    These are the following apps that I need:

    Photoshop

    Lightroom

    Illustrator

    Premiere Pro

    After Effects

    Hearing

    Is there a way I can pay just for these applications (and not pay $20 / month/app, otherwise it is worth it to buy all the)

    I do not work for Adobe, but I read this type of question many times before

    The answer is always no, Adobe has no plans to 'make your own '.

    Adobe offers two plans

    -Special photography Plan includes Photoshop & Lightroom and Bridge & Mobile Lightroom

    -l' set of Cloud http://www.adobe.com/creativecloud/catalog/desktop.html

  • Photoshop Elements 12 - create your OWN custom shapes

    I was wondering if there was a way to create your own custom in Photoshop elements 12 shapes. Tutorials that I looked but I found only those for regular Photoshop in which they use the tool pen and paths window, something 12 elements do not seem...

    rm2425 wrote:

    I was wondering if there was a way to create your own custom in Photoshop elements 12 shapes. Tutorials that I looked but I found only those for regular Photoshop in which they use the tool pen and paths window, something 12 elements do not seem...

    Elements has much less features with vectors as the full Photoshop.

    That said, it is possible to create and work with your own shapes if you us different add-ons, in particular of the elements + (on items + , very affordable).

    Read the section 'Ways': paths

    To save your creations of vectors (for example with paths from selections), save your vector layer in a psd or tiff format that you can then use in new designs.

  • GET RID OF THE POPUP "MY MSN, MSN TO MAKE YOUR OWN.

    * HI: At the opening of my laptop using Windows 7 HomePremium, whenever I get the PopUp BORING "MY MSN; "MAKE MSN YOUR OWN." Well, I already have MSN and default to "MY MSN" at the opening of the computer. HOW CAN I GET RID OF THIS ANNOYING POPUP, ONCE AND FOR ALL.

    WLD APPRECIATE YOUR HELP.

    Thank you.

    It seems that cookies are deleted when you leave ie9,

    Open ie9,

    Hold down the ALT key and type these letters to

    See if the Delete browser to exit history is enabled.

  • The best way to make your own lens flares and light highlights/streaks

    I have not money for Knoll Light factory lens flares so I need to make my own flares, splinters, highlights and streaks.  Anyone has any advice on the best way to do it.  Or is there somewhere a tutorial on it.

    Thanks in advance.

    With CS4 production premium on a Mac

    Classic: http://aestuff.myleniumstuff.de/?p=7

    Aside from that, you can generate a lot of light and reflections by stacking multiple effects and working with duplicates of the layer - extract the highlights using levels or threshold, apply the directional blur etc., coloring with Ting, Tritone or Colorama, apply a layer of mixture of modes to the source...

    Mylenium

  • How to make your custom data type used in your QListDataModel to QML?

    I have QListDataModel filled with objects of a custom class carying data and defined with Q_DECLARE_METATYPE. So far, it works however I can't access the data in qml:

    e.g. text: ListItemData.Name
    

    I read that this can be solved by letting QML know your custom class/type, but how to do this?

    See

    https://developer.BlackBerry.com/native/documentation/Cascades/dev/integrating_cpp_qml/

    example:

    qmlRegisterType("com.isec7.materials", 1, 0, "Account");
    
  • How to add Skype call/Message to your own custom button?

    Hello

    I want to add a button to my site that when clicked, will start a chat with me message in the application of Skype users.

    Skype has an option to create a button on their site, but I want to use my own look of continuity in my site (see image)Screen Shot 2015-11-12 at 5.24.34 PM.png

    Here is the code they gave me when I made the button on their site:

    " < script type =" text/javascript"src =" http://www.skypeassets.com/i/SCOM/js/Skype-URI.js "> < / script > .

    < div id = "SkypeButton_Call_ostettd_1" >

    < script type = "text/javascript" >

    Skype.UI ({}

    'name': 'cat ',.

    'Elément': 'SkypeButton_Call_ostettd_1 ',.

    "participants": ["ostettd"]

    });

    < /script >

    < / div >

    Please see the help sites:

    https://www.YouTube.com/watch?v=prjLe8kt_Tg

    http://StackOverflow.com/questions/16054167/how-can-i-use-Skype-URI-js-with-personalized-b uttons

    Thank you

    Sanjit

  • I don't want to use this patch until my Norton Tool bar stiill can be used. How to make your guest to download leave me alone?

    The prompt to upgrade to the latest version of Firefox appears every few hours. I said 'Ask Me later' a lot of times and I'm really tired of it, but it seems to be my only choice. I don't want an upgrade until I can keep my Norton Tool bar that works fine now. So, how can I disable your pop-up infuriating? I'm not a geek, so please I need a simple answer.
    Thank you

    Edit: removed your email address from the public view, since the only thing that will attract are spambots. you will be notified by email whenever someone replies to the thread. (philipp)

    Hello

    Symantec (the people who make the Norton products) has taken the decision to withdraw support for their toolbar in the latest version of Firefox (in spite of having a lot of attention to do). I found this page which gives more details around this and plans to get a fix in place very soon.

    I recommend that upgrade you to the latest version of Firefox to take advantage of the new features and security enhancements that are included in the browser. There is a new version of reason rather quickly who has added and improved features of the privacy that you may be interested.

    If you do not want to disable update guests you get, type Subject: preferences #advanced in the address bar and select Update. This will present you the options to turn off the future, even if updates for general health and well-being of your web browsing, I suggest keeping Firefox updated and wait for the Symantec fix for your Norton product.

    I hope this helps, but if not, please come back here and we will try to find another solution for you.

  • How to make the guides using methods SDK?

    Hi all

    I have a request. How can we make guides via calls to functions.. SDK ? I was unable to find something like this... Help, please... There is no piece of code in the samples too...

    Thank you!

    Hello

    Of course, once you have created the path with sAIArt-> New (...), nothing is displayed, you must specify the coordinates for each point of your future guide.

    For a horizontal guide, you write something like

    AIPathSegment S;

    AIArtHandle MyPath;

    error = sAIArt-> (kPathArt, kPlaceAboveAll, Nile, & MyPath); NewArt

    The guide will have two points.

    error = sPath-> SetPathSegmentCount (MyPath, 2);

    Position of the first point.

    S.p.h = 10;

    S.p.v = 120;

    S.in = S.out = S.p;

    error = sAIPath-> SetPathSegments (MyPath, 0, 1, &S);)

    Position of the second point.

    S.p.h = 800;

    S.in = S.out = S.p;

    error = sAIPath-> SetPathSegments (MyPath, 1, 1, &S);)

    The path will be a guide.

    error is sAIPath-> SetPathGuide (MyPath, true);.

    This time, a horizontal guide will be created and will appear in (10; 120) to (800; 120).

    JLG.

  • How to create your own alarm for agents of the oracle

    Hello

    I have about 100 agents to oracle

    I have been asked to keep an eye on the UNDO tablespace

    I used the rule of tablespaces that does the job but has a warning and a value critical low

    I can't change these values

    Then I look at creating the same rule as for storage space, but only to the UNDO tablespace where I could put different values for warnings and criticisms

    Thank you for your help

    Concerning

    Courteous Philippe

    Radio-Canada/Radio-Canada company

    SR. DBA / admin Foglight.

    Hello

    what I suggest, is to copy the existing rule DBO - used Tablespace percentage, give it a name to identify it is a custom rule and change the scope of the rule so that it applies only to the UNDO tablespace:

    Scope:

    DBO_Tablespace where the content = "UNDO."

    Because there is a custom rule that he will not be in the dashboard global admin. So I would create new registry custom variables to contain your thresholds based on the following:

    DBO_TablespaceStorage-AllocatedUsedPct_Low

    DBO_TablespaceStorage-AllocatedUsedPct_Medium

    Then, modify the conditions of the rule to use these variables.

    for example, putting warning

    From:

    condition = (#DBO_allocated_space_used_pct_for_rules # > = registry("DBO_TablespaceStorage-AllocatedUsedPct_Low"));

    Return DBWC_RacAndSingleInstanceRuleFilter (scope, "BOD - Tablespace used percentage", "2", status);

    TO:

    #DBO_allocated_space_used_pct_for_rules # > = registry("DBO_TablespaceUNDOStorage-AllocatedUsedPct_Low")

    Also update the message to your needs.

  • How to make your desktop Intel premium into a wifi hotspot

    I have a desktop connected to the Ethernet.

    Asking how to turn on wireless sound to use my wireless compatible Android smart phone.

    Hi Eugene,

    Thanks for posting your question in the Microsoft Community.

     

    1. What is the brand and model of the modem/router?

    2. who is the ISP?

    If you have a wireless router, you can connect to Internet wireless to your Smartphone.

    If you have a cable modem, you need to buy a wireless router to access the Internet wireless.

    For reference:

    Set up a wireless network:

    http://Windows.Microsoft.com/en-in/Windows7/setting-up-a-wireless-network

    If you need further assistance on this topic, let know us and we will be happy to help you.

  • How to make your laptop a wifi device

    Hello

    I have inspiron n5010 laptop with card dell wireless 1501. I use a wired broadband for internet.is there anyway I can make my laptop a wifi device so that I can connect my laptop with internet with wifi

    Hi aamerpk,

    Yes, the 1501 wireless card is capable of generating signals wireless mobile devices; You must install a software that converts the signals into mobile hotspot.

    There are free and paid software available online, controls this links:

    http://bit.LY/XlXY9S

    http://bit.LY/WA7vOu

    Note: This is a third party site, the site may have its own terms and conditions and there could be no warranties for the software. However try to install if necessary.

    Please answer for additional help.

  • How to make your laptop a wifi hotspot

    I use the USB modem to access the internet on my laptop... now I want to access internet on my smartphone via Wifi... How to share internet to connect by USB modem?

    Hopefully this thread will help you http://answers.microsoft.com/en-us/windows/forum/windows_xp-networking/how-do-i-enable-wifi-capability/cb4bbb46-59fa-40e0-a96a-b5a79078a0d8

    Alternatively, you can try 3rd party Software Mhotspot of http://download.cnet.com/MhotSpot/3000-18508_4-75452123.html . It is very easy to use.

Maybe you are looking for