Results 1 to 9 of 9

Thread: alternative to navigate URL

  1. #1
    Join Date
    Jan 2008
    Location
    Near Chicago
    Posts
    247
    Thanks
    105
    Thanked 2 Times in 2 Posts

    Default alternative to navigate URL

    In another post I mentioned save jpg and targeting the save -the problem then was to get control over the snapshot, well the long and short of it there isn't.

    but with bitmapdata and copyPixels you can control the coordinates of what is being copied.

    Bitmapdata class seems to only copy from existing flat files or objects like jpgs unless I'm wrong. It would save alot of work if the bitmapdata could just export the file rather than just display the selected pixels.

    so, what I will do is save the whole stage as a jpg, import it and select the pixels and move it to 0,0 coord and do another save.

    so in order to get that to work, I will need to save the jpg to a folder on the server.

    can I use navigateToURL () ? -It only seems to target _self, _blank, _parent, etc.

    can I specify a file with it? if so how do I assign the path to save it?

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    I saw your other post, and I will admit I stayed out of it cause I was confused, as I am now.

    Is what you want to do:

    Have a picture, image, MC [insert anything here] on the stage in Flash, have the user use the mouse to select any portion of said [inserted previously] then save that selection to their computer?

    Am I even close? LOL If I can understand what you want I may just be able to build a working example for you.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. The Following User Says Thank You to BLiZZaRD For This Useful Post:

    evan (09-08-2008)

  4. #3
    Join Date
    Jan 2008
    Location
    Near Chicago
    Posts
    247
    Thanks
    105
    Thanked 2 Times in 2 Posts

    Default

    Ok and again appologies to anyone who WOULD offer their help but are put off if I'm not clarifying it well enough.

    Initially I had Two projects in mind.

    one where the user could select and save part of what's on the screen and use a moving sprite as a camera. -that was for fun

    what I will need is to implement a save feature into a drawing pad.
    --get the legnth and width of the pad , the coordinates to copy it.
    (-copyPixel) -and then save it, and store it.

    -so I'm learning about Bitmapdata and copy pixel and jpeg encoder, the display list - loaders at once (in AS3) and trying to apply it from tutorials.
    take this example:


    var penguinsBmd:BitmapData = new Penguin(0,0);
    var penguinsBm:Bitmap = new Bitmap(penguinsBmd);

    function onClick(evt:MouseEvent):void {



    //OK --this part determines the L/W size of the area to be copied

    var penguinCopyBmd:BitmapData = new BitmapData(300, 300);

    //w/h/x/y
    //the loaction of where the copying takes place:

    var rect:Rectangle = new Rectangle(200, 200, 300, 300);

    //this carries out the copying:

    penguinCopyBmd.copyPixels(penguinsBmd, rect, new Point());

    //this is the instance of the copied pixels:

    var penguinCopy:Bitmap = new Bitmap(penguinCopyBmd);

    //the placement of the copied pixels:

    penguinCopy.x = 10;
    penguinCopy.y = 10;
    but I realize this code is only good for applying it to a bmp or jpg that is imported

    var penguinsBmd:BitmapData = new Penguin(0,0);
    var penguinsBm:Bitmap = new Bitmap(penguinsBmd);
    so what to do ...if I want to copy something that is dynamicly drawn or dragged onto the stage?
    -then there is saving it to a directory. I haven't given up yet.


    I stay up alot with this now so I appologise if my brain is turning to mush.
    Last edited by evan; 09-08-2008 at 07:58 PM.

  5. #4
    Join Date
    Jan 2008
    Location
    Near Chicago
    Posts
    247
    Thanks
    105
    Thanked 2 Times in 2 Posts

  6. #5
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Hey Evan...

    I didn't read your second and third posts. This is just to answer your question about sending variables to PHP w/o using navigateToURL.

    First of all, navigateToURL is not what you're looking for. I suppose you're using the AS 2.0 mindset where getURL() might have worked.

    But in this case, navigateToURL() does what it says...navigates to it. To send PHP variables back and forth, you should be sendToURL().

    For example...
    Say you're creating a email form and you need to send the email to a PHP script from a textarea. Your AS3 might look like this:

    Code:
    var request:URLRequest = new URLRequest( "http://mysite.com/submit.php" );
     
    var variables:URLVariables = new URLVariables();
    variables.email = emailSubmitText;
     
    request.data = variables;
     
    request.method = URLRequestMethod.POST;
     
    sendToURL(request);

    As to your question about BitmapData...I'm just as confused as Blizzard. From what I understand, you're trying to output a .jpg from a selection of the stage. Is that correct?

  7. The Following User Says Thank You to Medyman For This Useful Post:

    evan (09-09-2008)

  8. #6
    Join Date
    Jan 2008
    Location
    Near Chicago
    Posts
    247
    Thanks
    105
    Thanked 2 Times in 2 Posts

    Default

    Mendyman,
    -I also disected the code from the link you sent -
    I got alot out of it.

    -great advice :
    you should be sendToURL().


    that's it.

    the drawing pad is in the middle of the page. copy pixel is great for doing just that -and then setting up ways to manipulate pixels. -But it only works with "flattend" images.

    the save jpg ability -at least the way I see it used only allows me to save the whole screen, the upper left hand side of the screen -or an object by itself -such as a sprite (not what lies on top of it).

    I want to be wrong here -otherwise I am planning a workaround.

  9. #7
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Hey Evan...

    Unfortunately, you're right. You need to use the workaround. BitmapData only works with a byteArray. So, you need an actual bitmap image to use any of those methods.

    You *might* be able to just capture the whole screen and save the data into a byteArray and manipulate it internally. Therefore, it removes the need to save it and then import it. But, I've never done this so I can't say for sure.

    If you want to post all the relevant code, I might be able to play around with it and offer a suggestion.

  10. The Following User Says Thank You to Medyman For This Useful Post:

    evan (09-10-2008)

  11. #8
    Join Date
    Jan 2008
    Location
    Near Chicago
    Posts
    247
    Thanks
    105
    Thanked 2 Times in 2 Posts

    Default save jpg to disk

    can I save a jpg straight to disk?

    with send to url, would that imply that I can specify a path on a server

    re:send url:
    would that work?

  12. #9
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Quote Originally Posted by evan View Post
    can I save a jpg straight to disk?
    Nope...security implications. You have to have a server as an intermediate.

  13. The Following User Says Thank You to Medyman For This Useful Post:

    evan (09-11-2008)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •