CreateChildSymbol on the top left bottom right edges of the window/stage?

I am creating a particle system and I am trying to generate the particles / CreateChildSymbol on the top left bottom right edges of the window/stage?
Currently I am generating random X & Y points but thats not really doing what I need.
// find the stage width & height
sym.maxWidth = $('#Stage').width();
sym.maxHeight = $('#Stage').height();
// randomize the numbers 1-12
var randomSymbol = Math.floor((Math.random()*12)+1);
// Pull symbol from lib and add to stage
sym.mainParticle = sym.createChildSymbol("symbol_ani_" + randomSymbol, "Stage");
// create jQuery object / Edge Ani element var
sym.mainParticleElement = sym.mainParticle.getSymbolElement();
// randomize the stage X & Y coords
var randomX = Math.floor(Math.random() * sym.maxWidth);
var randomY = Math.floor(Math.random() * sym.maxHeight);
// position  based on random stage X + Y position
sym.mainParticleElement.css({'position':'absolute','top':randomY+'px','left':randomX+'px'} );
But I am at a loss of how to randomize the top / right / bottom / left X & Y edges of the stage

Got it working!
Well to be honest another friend helped me work out the logic for randomizing the sides (top, left, bottom, right) to get it working.
But I wanted to share since I had a hard time finding anything releated to this topic. Big Ups to Resdesign + Tim Jaramillo for helping me with some logic along the way as well!
// these variables are global within compReady would need to change to sym. instead of var if needed outside of this
var moveToX = $(window).width()/2,
     moveToY = $(window).height()/2;
function spawnParticle() {
     // these variables are only availabe inside this function
     var side = Math.floor(Math.random() * 4),
         offScreen = 100,    // how many pixels off the side of the screen to start
         yRand = Math.floor(Math.random() * $(window).height()),
         xRand = Math.floor(Math.random() * $(window).width()),
         xPos = 0,
         yPos = 0;
     switch (side) {
         case 0:
             xPos = xRand;
             yPos = -offScreen;
             console.log('spawn from top');
         break;
         case 1:
             console.log('spawn from right');
             xPos = $(window).width() + offScreen;
             yPos = yRand;
         break;
         case 2:
             console.log('spawn from bottom');
             xPos = xRand;
             yPos = $(window).height() + offScreen;
         break;
         case 3:
             xPos = -offScreen;
             yPos = yRand;
             console.log('spawn from left');
         break;
     // add to the stage
     sym.mainParticle = sym.createChildSymbol("star", "Stage");
     sym.mainParticleElement = sym.mainParticle.getSymbolElement();
     sym.mainParticleElement.css({'position':'absolute','top':yPos+'px','left':xPos+'px'});
     // simple animation to reveal the particle
     sym.mainParticleElement.animate({ left: moveToX, top: moveToY }, 1000, function() {
         // for this test, I'm removing the particle after it has finished animating
         $(this).fadeOut(function() {
             $(this).remove();
// keep spanwing new particles
setInterval(spawnParticle, 500);

Similar Messages

  • Opening a new URL, a blank page appears with 2 messages on the top left and right corner of the window: "Advertise here" and "Skip this ad" and it will not go to the requested site until I push "Skip this ad"

    It would be nice to have the possibility to attach a print screen or something to give you a better idea what is happening and how it looks like.
    Anyway, what I described above is accurate:
    - the address bar shows the link where I wish to go
    - but the page loaded is blank with these 2 hyperlink messages ("Advertise here" in the top left corner, and "Skip this ad" in the top right corner).
    I would like to emphasize that it does not have to do with the requested URL: it does the same thing with all sites, all the time.

    For me is the same, it's yet 6 months.
    the blank page apears for the first 20-30 of the day's navigation, then no more.
    For example: If I open firefox at 9 a.m., it appears until 9.30 more or less. If i surf the web until mignight, at 00.01 a.m. this page starts bugging me.
    I have yust to click on the link "skip this ad" to return to the desired web page.
    Using Adblockplus and NoScript plug-ins had sadly no effect.
    I've read somewere that the ploblem should be an f**** adware called "directCPV"., and that the solution is toremove an .exe file called Directcpv.exe or somewhat else, but in my pc I haven't found any of those linked to this adware.
    I tried a full system scan with an antivirus (McAfee), with Malwarebytes, Ad-Aware, ATF cleaner, Spybot, Exterminate-it but NO RESULTS.
    I tried to do this in safe mode too.
    No way cleaning the cache, temp files, cookies etc.
    finally I tried to uninstall Firefox (cleaning all registry entry too) and reinstall it, but the problem is still there.
    The only cure seems to be formatting the HD, but it's very last chance.
    If someone have an idea, please post it here.

  • HT1677 iOS 7 for iPad the bookmarks tab is now on the top right hand side how can I change this back to the top left hand side as in the previous versions?

    iOS 7 for iPad the bookmarks tab is now on the top right hand side how can I change this back to the top left hand side as in the previous versions? Thanks

    Sorry but you can't

  • In the top left on my screen where the back arrow is, there used to be a drop down arrow to skip back many pages. After installing 4.0.1, it has disappeared. How do I get it back?

    In the top left on my screen where the back arrow button is to go back to previous webpages, there used to be a drop down arrow just to the right so I can see many of my previous web pages. Since installing Firefox 4.0.1, that arrow disappeared.

    You can get the drop down list by either right-clicking on the back/forward buttons, or holding down the left button until the list appears.
    If you want the drop-down arrow you can add it with the Back/forward dropmarker add-on - https://addons.mozilla.org/firefox/addon/backforward-dropmarker

  • How do you make a "div" tag stretch to the top, left and right?

    Hi, i'm making a professional website on dreamweaver with both codes and WYSIWYG data however i've noticed top, left and right in the CSS script for my div tags. do you know how i can "stretch" the left, right and top to make it look like one of the top div tags on one of these sites:
    http://www.neopets.com/ products div tag above the site that mentions other nick products

    Go into  http://images.neopets.com/css/default.css?v=3
    And change the width of the header from 996px to 100%.
    Gary

  • The arrow at the top Left  of the search line has been replaced by a   sign which can be used to add bookmarks. How can I restore the arrow at the top left to go back to the previous page?

    When Safari is opened on my MacBook Pro, the arrow at the top  left ( of the search bar where I type what web site I am searching) has been replaced by the sign + which I can click on to add a bookmark... How can I restore the arrow that I can use to access the previous page?
    What should I should do?
    Tx

    raymond ==
    Go up to the main Safari menu bar above, and select "View."
    Then when that bar comes down, select "Customize Toolbar."
    Then select the arrow icon, and just drag it into your toolbar.

  • Bought iphone 5C on December. No additional warranty purchased. The phone keeps not working and the top and bottom right corners look melted. Can I send it in amd get a new one on manufacturer warranty? Or what are my options? Thanks

    I Purchased iphone 5C on December 2014. However now it's very difficult to have it working. The screen is constantly not working and the right side bottom&top does looks like its melted? the cover I mean , which maked the phone slide out of its cover. I did not purchase anny additional warranty or insurance so I don't know what to do with it? Can i send it in and they can send me a new one under the manufacturer warranty or what do i do with it?
    I Have alwa had an iphone but this 5c is making me never have one again. Thanks in advance

    Each iPhone comes with a one-year warranty. You said it looks melted? That's going to be difficult to prove that you did not damage it, and it happened on its own. That is the only way it would be covered.

  • About mx:states top left bottom right border

    Hello,
    I have question maybe somebody can help me.
    I want to use states in my application by i have discoveder
    one disadvantage.
    Using states it comes with some value of left, right, bottom,
    top. So i cant find our how to place states which fits 100% width
    and height in application
    Link

    We're just using Javascript's built-in sort() function, which is typically a Mergesort, but doens't have to be.
    All we're doing is giving it a comparison function so it knows which element comes first, for any given pair of elements.
    Your loop...looks to me like it is a variant on bubble sort but that it probably does not work correctly? It is hard to compare known sorting algorithms to made-up ones...you should almost always use an existing algorithm, rather than one of your own. It is too easy to make mistakes.

  • Every time I scroll, there's a clicking sound coming from the top left corner of my macbook

    Similar to the clicking sound of my hard drive, every time I scroll, or whenever there is any sort of animation on my screen, there's a similar clicking sound coming from the top left corner on my , around the area where the microphone is. I know the hard drive is at the bottom right corner, so is this a graphics card issue or am I overlooking the issue?

    It is better to take the MBP to the Apple store for evaluation.
    They have the diagnostic tools to make sure that there is no problem with the computer.

  • Get rid of the white space at the top and bottom of the report when Printing as PDF document

    Hello All,
    I have a wider tablix report which is 29 inches wide. I have given the paper size as custom and width as 29 and height as 11 in report properties.I have deployed it and saved it as PDF document. When I print preview the report I am using the paper size as
    tabloid (17 by 11) and selected the orientation as Landscape. I am getting the full report without any stripping but I am getting some extra space at the top and bottom when I print the report. Can anyone help me how to get rid of this space? . I checked the
    margins for the report and it was 0in. Please help.
    Thank You

    Hi There
    In Reporting Services (SSRS 2008), there are white spaces preserved in the report body by default. When the white space extends the body size beyond the width of the report, blank pages will be generated. To avoid the issue, you can set the “ConsumeContainerWhiteSpace”
    property of the report to “True”.
    Please try to adjust your margins (top + side) and hopefully this problem will get resolved
    Body Width <= Page Width - (Left Margin + Right Margin)
    Horizontal usable area:
    X = Page.Width - (Left Margin + Right Margin + Column Spacing)
    Vertical usable area:
    Y = Page.Height - (Top Margin + Bottom Margin + Header Height + Footer Height)
    Body Width <= Page Width - (Left Margin + Right Margin)
    Horizontal usable area:
    X = Page.Width - (Left Margin + Right Margin + Column Spacing)
    Vertical usable area:
    Y = Page.Height - (Top Margin + Bottom Margin + Header Height + Footer Height)
    If you have any questions please ask.
    Many Thanks
    Syed Qazafi Anjum
    Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.

  • Changing my page size from American A4 to UK A4 shifts everything on the page, if I want everything on the page to stick to the top left rather than shift around, what do I do?

    Changing my page size from American A4 to UK A4 shifts everything on the page, if I want everything on the page to stick to the top left rather than shift to the right and down, what do I do?
    Using Indesign CS6.

    @Gabrielle – if you change the size in your document setup, pages always crop from the center of your spread, if you are using facing pages:
    Uwe

  • I have placed my SIM card into my iphone 5c and have confirmed co with my cellular network provider.However despite numerous reboots I am still getting "No Service" in the top left corner. Please advise

    I have placed my SIM card into my iphone 5c and have confirmed co with my cellular network provider.However despite numerous reboots I am still getting "No Service" in the top left corner. Please advise

    Contact the carrier and troubleshoot the issue.

  • How to display COMPANY CODE DESCRIPTION ON THE TOP LEFT OF PAGE

    How to display COMPANY CODE DESCRIPTION(Field BUTXT) ON THE TOP LEFT OF EVERY PAGE OF THE REPORT GENERATED.
       Actually I have collected BUTXT using
    'select butxt into table itab from t001 where bukrs = p_bukrs'
    where p_bukrs is the selection screen field.
    REQUIREMENT: Depending on what company code we give on the selection screen, corresponding company code description(butxt) should be displayed at the top left of every page. how would i display it in TOP-OF-PAGE EVENT.

    Hi
    It's very simple, but what is the need to use <b>into table itab</b> in your select query.
    Rather, define a variable
    data: v_butxt type t001-butxt.
    Select butxt into v_butxt from t001 where bukrs = pbukrs.
    TOP-OF-PAGE.
    write :/ v_butxt.
    Regards
    Surya.

  • Starting from the top... and working down the Dim...

    Can anyone help ?We all know that Essbase naturally calcs from the bottom up.However, I'm wanting to start at the top of a dimension and work my way down eg...If Sales at "Total Markets" > 0 use the value of Sales. Finish.Else If the "Total Market"s children > 0 then use the value of Sales. Finish.Else Next level down etc etc. until lev0 is reached.I'm sure it can be done (efficiently, or otherwise!).Hope to hear from you. Thanks.

    move the tables so there is adaquate room to accomadate the reference headers:
    When the unlocked table is active the reference tabs appear and the spacing between them accomadates without interference:
    Perhaps if you can post a screenshot we can be more help:
    To post:
    - capture using the key command <command> + <option> + 4
    - the cursor will change to a crosshair
    - click and hold the top-left corner, then drag to the bottom-right corner
    - release
    - a file will appear on the dsktop named something like "Screen Shot 2013-09-04 at 7.40.34 AM.png" where the date and time are updated
    - return to this forum and click the camera icon in the toolbar
    - navigate to, and select, the screenshot image on your desktop

  • How to adjust the green (starting) and the red (end) rectangles pixel by pixel (top, bottom, left and right) by changing the number of pixels in ken burns.

    How to adjust the green (starting) and the red (end) rectangles pixel by pixel (top, bottom, left and right) by changing the number of pixels in ken burns. Help please.

    If you look closely at the top of the canvas pane, as you move either of the boxes (green or red) there is an indication of pixel positions... "top, bottom, left, right," and "scale."
    Admittedly, it doesn't seem as if you can "enter" the dimensions with your keyboard, however, as you move the boxes, you have a real time indication of the boxs' locations.
    (I couldn't take a screen shot, as you have to actively move the box with a mouse or other input device... thus, I could not also take a screen shot with same device.)
    I hope this helps.

Maybe you are looking for