Slice image with actionscript

Hi,
I want to create animation. I want to slice image into random number of rectangles (it can't be squares) and I want to animate all of this rectangles at once.
Any ideas?
Best whishes,
sledz

Use BitmapData class:
read original BitmapData --> read pixels that fit into rectangles (getPixels method) --> create Bitmaps out of individual rectangle's BitmapData --> animate Bitmaps.
Documentation:
http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/BitmapData.htm l
http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/Bitmap.html
Also search for BotmapData tutorials - there are a lot of them.

Similar Messages

  • Create an image with ActionScript

    How do you create an image with ActionScript? The image is
    located at an url that is not guaranteed to be on the same server.
    I would prefer something that is compatible with previous
    versions of the Flash player.
    If you could point me to some tutorial or show me how it is
    done.
    Thanks

    This is suuuuuuuuuuuuper basic, you just have a movieclip on
    the stage and the URL of any image on the internet/local computer
    function loadImage(imageUrl:String,
    holder_mc:MovieClip):Void{
    holder_mc.loadMovie(imageUrl);
    Fill the two parameters with the 1. image url and 2.
    movieclip that holds the image
    It will load the image into it. Much more in depth tutorials
    and stuff can be found all over the place, just google it.
    Sam

  • Moving an image with actionscript

    I'm trying to move an image from position Y:0 to Y:-100 using
    actionscript when the .swf file loads, as this is smoother than
    conventional tweening??

    Well Sim-Enzo is almost correct. You will have some problems
    though because it is not really complete.
    When you want to do things over time (move, fade, scale,
    etc.) with actionscript you have two main choices –
    onEnterFrame and setInterval. For the example given by Sim-Enzo I
    would rewrite it like this:
    myImageClip.onEnterFrlame=function(){
    if(this._y>-100){
    this._y-=10;
    }else{
    delete this.onEnterFrame;
    this._y=-100
    Here are why I would make these changes.
    First the onEnterFrame is poorly named and confuses a lot of
    folks. So remember onEnterFrame means "do this next bit of code at
    the frame rate of the movie – even if the timeline is stopped
    or there is only one frame."
    Next. Each movie clip instance can only have one onEnterFrame
    handler defined for it. So it is a good idea to assign each one to
    an appropriate clip to avoid problems. By attaching this one to the
    clip you want to move, myImageClip, you will also be able to assign
    other ones to other clips and do whatever they need to do.
    Then inside the event handler, notice how I refer to the clip
    by "this" since the onEnterFrame is scoped to the myImageClip.
    Finally, and this is probably most important, I have added an
    else to the conditional. This makes sure that once your clip has
    move to where it is supposed to go that the onEnterFrame is
    stopped. Otherwise the onEnterFrame would just keep going –
    it wouldn't move the clip anymore, but it would be using up
    processor time. One errant onEnterFrame like this wouldn't probably
    bring down your swf, but if you didn't do it with many different
    ones you would notice.
    I also added a little bit there which put the clip exactly at
    the place I wanted. There are times in Flash where rounding errors
    or other issues can make for surprises. I think it is good practice
    to set the value to the exact required value.

  • Need help displaying images with List component for Flash CS4 (ActionScript 3.0)

    Hi folks:
    I am an inexperienced user of Flash CS4 Pro (v10.0.2). I am attempting to use the List component with ActionScript 3.0 to make a different image display when a user clicks each item in a list.
    I did find a tutorial that showed me how to make different text display using a dynamic text box and the following ActionScript:
    MyList.addEventListener(Event.CHANGE, ShowSelectedItem);
    function ShowSelectedItem(event:Event):void {
        ListText.text=MyList.selectedItem.data;
    ...where My List is the instance of the List component and ListText is the dynamix text box. In this case, the user clicks an item in the list, defined by the label value in the dataProvider parameter of the List component, and text displays as defined in the data value in the dataProvider parameter.
    However, as I mentioned to start, what I really want to do is make images display instead of text. Can anyone provide me the steps to do this?
    I appreciate your help (in advance)!!
    Cindy

    Hi...thanks for responding! I was planning on using images from the Library, but if there is a better way to do it, I'm open. So far, I just have text in the data property. This is part of my problem. I don't know what I need to put in the data value for an image to display. Do I just put the image file name and Flash will know to pull it from the Library? Do I need to place the images on the stage on different frames? I apologize for the "stupid user" questions, but as you can tell, I'm a newbie.
    Appreciate your patience and any help you can offer!
    Cindy

  • To print an Pie Chart image with more than 1 slice is not working

    Hi friends,
    I'm using a version 12.0.4 and when I try to generate an Pie Chart image with more than 1 slice using the function saveImage() it's not working. The image is only generate when its return is just 1 value (1 peace of pie).
    Anybody help me?
    Regards!

    It's not unique for your setup, but it also happens in 12.0.11, so it's a bug.  Looks like it is throwing a null pointer for some bizzare reason when generating the GIF output by the ImageStorageServlet (per the NW logs). 
    Your best bet would be to log a ticket so it can be patched.
    12.1.7 seems to work fine.
    Edited by: Michael Appleby on Nov 23, 2010 2:39 PM

  • Want to add an image but with actionscript not a s:Image

    hi. i've looked for a good answer but can't seem to find one...i have a few images i want to add to my app at run time and don't want to use a whole lot of <mx:Image> components...just want to do it with actionscript. i get to the point where i've got an Image object and embedded the source of the Image object but don't know how to add the Image to the display list? thx

    on the same issue...i'd like to use some of the functions of the Sprite class....so i've got my image and added that to a Sprite object but can't seem to add the Sprite to any of the spark/mx containers...keep getting this error:
    Main Thread (Suspended: Error: addChild() is not available in this class. Instead, use addElement() or modify the skin, if you have one.)
    spark.components.supportClasses::SkinnableComponent/addChild
    play/init
    play___play_Application1_creationComplete
    flash.events::EventDispatcher/dispatchEventFunction [no source]
    flash.events::EventDispatcher/dispatchEvent [no source]
    mx.core::UIComponent/dispatchEvent
    mx.core::UIComponent/set initialized
    mx.managers::LayoutManager/doPhasedInstantiation
    mx.managers::LayoutManager/doPhasedInstantiationCallback

  • Painting with Actionscript

    Hi all,
    I have some pictures of the interior of a house and I want
    the user to change the color of the walls. When I try to fill some
    areas of the image with a specific color I get some "unreal"
    results, and the final picture is not neat. I wander if there is
    some clever way to change the color leaving the lighting, shadows
    etc as they are to have a more realistic result.
    I'll appreciate if someone have any useful links or
    guidelines for this, thanks in advance

    jgeorgiou,
    > there is an EXCELLENT desktop application I found in
    >
    http://www.crownpaint.co.uk/expcolour/create/
    following
    > the link "Dowload My Rooms in Colour Tool", but it's
    > not made with Flash.
    I didn't download the app, but I did watch the Flash
    demonstration.
    > Is it possible to have this result with ActionScript?
    The demo showed a user clicking around a photo to define
    anchor points,
    then filling the enclosed shape with a color. This sort of
    thing is indeed
    possible with ActionScript, and when combined with blend
    modes might give a
    reasonably "realistic" rendering.
    What you're after is a collection of MovieClip class methods
    known as
    the Drawing API. Look up MovieClip.lineTo() in the
    ActionScript 2.0
    Language Reference and you'll find the others. :)
    David Stiller
    Adobe Community Expert
    Dev blog,
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • Can't slice gradient with adjusted bright/contrast filter

    I was playing around with gradients, and finally came up with something I wanted to try on my site. I'm taking a shade of yellow (#CC9933), then adjusting the colors with a brightness/contrast filter (brightness -81, contrast -8). But when I try to export a slice of the image, or just copy it to another Fireworks file for export, I am getting the original, bright yellow gradient, not the darker gradient with the adjusted brightness/contrast settings. What am I doing wrong?
    I've attached a copy of the image I'm working with. It shows both the image with the adjusted colored gradient I want, and (to the right) how the slices are looking like.
    Thanks much to anyone who can help

    Thank you, Jim. I don't know what I was doing last night. Everytime I tried to export or copy from
    the darker image, I'd get the lighter one in Dreamweaver. I just tried it after reading your posting, and it works fine now. I think the lesson for me is, don't work at 3:30 am.
    Can you recommend which format (jpeg or png24) I should export as? The darker image, that is. I don't want the lighter one.
    Thanks again.

  • Positioning images with css

    Hello everybody,
    thanx in advance for your help.
    Needless 2 say that my question would sound stupid to most of
    you, but if it sounded smart I would probably be the one to answer
    it and not to make it... It sounds logic, doesn't it?...I apologize
    for my reflection and I go straight to the point:
    PRESUPPOSAL:
    I created a pretty complex web-page design with Photoshop.
    It's not just about a logo in the 0% 0% position and some colored
    bar on the viewport border but a 800X600 image with lots of
    particulars.
    ISSUE:
    I'd like 2 put it on the html page with CSS.
    QUESTIONS:
    a)Shall I put the image as a whole?
    b)Or shall I sLice it as I'd do if I wanted to use a table to
    position it?
    If the a) is the correct option, won't the page be to heavy
    in terms of kbytes? (As far as I know a sliced image is overally
    lighter than an entire one)
    If the b) is the correct option, how can I position more than
    one picture with css in a html document? (I studied css from a
    short Molly Holzshlag's book and she only explains how to position
    1 single image)
    c)Is it ok to use CSS image-positioning to such an extreme
    extent? Should I prefer table-positioning considering my 800X600px
    goal? I mean, is there any technical problem I ignore? Is it a
    inapropriate use of CSS?
    Thank you so very much and enjoy the week!
    bye,
    Giuseppe, Rome

    Let's start by seeing your page, please.
    > I created a pretty complex web-page design with
    Photoshop. It's not just
    > about
    > a logo in the 0% 0% position and some colored bar on the
    viewport border
    > but a
    > 800X600 image with lots of particulars.
    I'm already worried. This sounds massively heavy....
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "giuseppe craparotta" <[email protected]>
    wrote in message
    news:[email protected]...
    > Hello everybody,
    > thanx in advance for your help.
    > Needless 2 say that my question would sound stupid to
    most of you, but if
    > it
    > sounded smart I would probably be the one to answer it
    and not to make
    > it... It
    > sounds logic, doesn't it?...I apologize for my
    reflection and I go
    > straight to
    > the point:
    >
    > PRESUPPOSAL:
    > I created a pretty complex web-page design with
    Photoshop. It's not just
    > about
    > a logo in the 0% 0% position and some colored bar on the
    viewport border
    > but a
    > 800X600 image with lots of particulars.
    > ISSUE:
    > I'd like 2 put it on the html page with CSS.
    > QUESTIONS:
    > a)Shall I put the image as a whole?
    > b)Or shall I sLice it as I'd do if I wanted to use a
    table to position it?
    > If the a) is the correct option, won't the page be to
    heavy in terms of
    > kbytes? (As far as I know a sliced image is overally
    lighter than an
    > entire one)
    > If the b) is the correct option, how can I position more
    than one picture
    > with
    > css in a html document? (I studied css from a short
    Molly Holzshlag's book
    > and
    > she only explains how to position 1 single image)
    > c)Is it ok to use CSS image-positioning to such an
    extreme extent? Should
    > I
    > prefer table-positioning considering my 800X600px goal?
    I mean, is there
    > any
    > technical problem I ignore? Is it a inapropriate use of
    CSS?
    >
    > Thank you so very much and enjoy the week!
    > bye,
    > Giuseppe, Rome
    >

  • I am using a Photoshop cs2, and I wonder if it is possible to keep the settings of the guidelines when closing an image, with the actual document ? It would be nice to have the guidelines locked down, I find it than when opening the same or another image,

    I am using a Photoshop cs2, and I wonder if it is possible to keep the settings of the guidelines when closing an image, with the actual document ? It would be nice to have the guidelines locked down, I find it than when opening the same or another image, the guidelines are not locked, it is annoying to have to lock them down again. and it would actually be nice, to ba able to give specific directions when placing the guidelines. Thanks

    Then why are the guides unlocked when I reopen a document that I saved with the guides locked ?
    Thanks.

  • Bridge CS4 won't output to pdf multiple images with same filename

    Hiya...my googling efforts have thus far failed!
    I've got CS4, and in Bridge, I created a New Smart Collection to find all filenames in a folder containing "." or ".jpg" - which in turn searched through all the subfolders like what you used to be able to do in Photoshop CS3.  Very simple stuff, but all the images are jpg's, but in multiple folders (I don't want to move them out of the folders, as the files came from an external source, and there are heaps of folders, and I don't want to pdf each subfolder seperately as it will take forever).
    The problem is that some of the files have the same filenames (again I'd prefer not to rename, as it happens a lot on this project, and they are all over the place).  So whilst Bridge will show the thumbnail images correctly in the content tabbed screen in my New Smart Collection, but once I've done the Output to PDF thing, for example, instead of showing both different images it has pdf only the first image but repeated it twice.  And this happens multiple times throughout the pdf, the more times the same filename is used, the more times the first image gets repeated.
    I know that it is messy to have multiple similar filenames, but why can't bridge just place the image anyway?  It allocated a space for it on the pdf and does show it in bridge, it just doesn't seem to survive the transfer to pdf well.
    The only other thing that I have done is use the below link (which was posted on another adobe forum thread) to create a custom pdf output template (nothing too fancy, just number of rows / columns, size, font etc).  But I've tried using the standard bridge templates and it does the same thing.
    http://www.proficiografik.com/2009/08/03/save-custom-pdf-output-template-in-adobe-bridge-c s4.html
    Any help would be appreciated...even if to tell me that I am being unreasonable!
    UPDATE 16/11/09
    Just to let you know that I seem to have resolved the bug inadvertently with one of the Adobe updates. The below is the link for the AdobeOutputModule-2.1-mul-AdobeUpdate.zip which was released on 2/19/2009 - which allows for headers & footers to be placed in the Ouput pdf. I finally installed it today, and everything seems to be working fine now (i.e. I can pdf multiple images with the same filenames and the pdf will actually show each different image rather than repeating only 1 of the images).
    Must have been a fix installed in the contact sheet templates that get installed with the update - not sure why the original version was corrupted, but I've left that with the Adobe guys (I submitted a bug report - and they were able to replicate the problem but hadn't fixed it as yet).
    http://www.adobe.com/support/downloads/detail.jsp?ftpID=4228
    Message was edited by: djtun71 (16/11/09)

    When I click import from disc I am asked to choose a disc and then I get this message:
    The following photos will not be imported because they are already present in the catalog. To see these photos in the catalog select 'Show in Library' (the import will be canceled).
    This is followed by a long list of images. If I click 'Show in Library' I can see all the images with the same filename. And then they start to automatically write over those images with images from the disc. However they keep the same metadata and keywords from the previous images. If I click on Import and deselect the "don't reimport suspected duplicates" box, it imports only the images that don't share filenames and none of the images that do.
    Is there a way of setting the "Don't reimport suspected duplicates" box in preferences?

  • Can't access object using "id" or "name" if created with actionscript

    How can you register an instance of an object with actionscript so that it's id or name value is accessible?
    I included a simple example where a Button is created using mxml and in the same way it is created using actionscript.  The actionscript object is inaccessible using it's "id" and "name" property.
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                   creationComplete="application1_creationCompleteHandler(event)">
        <fx:Script>
            <![CDATA[
                import mx.events.FlexEvent;
                protected function application1_creationCompleteHandler(event:FlexEvent):void
                    import spark.components.Button;
                    var asBtn:Button = new Button();
                    asBtn.label = "actionscript";
                    asBtn.x = 200;
                    asBtn.id = "asButton";
                    asBtn.name = "asButtonName";
                    addElement(asBtn);
                    trace("mxmlButton="+this["mxmlButton"].label); // returns: mxml  label
                    //trace("mxmlButton="+this["asButton"].label); // returns runtime error: ReferenceError: Error #1069: Property asButton not found on TestId and there is no default value.
                    //trace("mxmlButton="+this["asButtonName"].label); // returns runtime error: ReferenceError: Error #1069: Property asButtonName not found on TestId and there is no default value.
            ]]>
        </fx:Script>
        <s:Button
            id="mxmlButton"
            label="mxml label"
            alpha="0.8"/>
    </s:Application>

    Hi Dan,
    It is a very rare occurrence when I miss not being able to access an object (object property, really) using the ["name"] notation for objects created using actionscript.
    In MXML the compiler is conveniently adding an attribute to the class with the same name as the id, so you can conveniently refer to it using the [] notation. While we explicitly specify an application container to use, the MXML compiler creates a custom container which is a derivative of the base container and to that it adds properties for the children declared in MXML. I guess it also effectively calls "addElement" for us when  the container is being constructed.
    Your example assumes that using "addElement" to add the button to the application container is the same as declaring a variable (ie property ). It isn't, so there's no point in looking for an property of the name "as3Button" using the [] notation, because it doesn't exist. The container is managing a collection of children in it's display list and that's not the same as being accessible as properties of the container.
    Generally speaking, accessing properties using the ["name"] syntax isn't necessary.
    Paul
    [edit: you may wonder why "addElement" doesn't conveniently also add the "id" attribute to be an property of the container class. Unfortunately, it can't because the container class would need to be dynamic and it's not. A further complication would be that adding properties at runtime would invite naming clashes at runtime with associated mayhem. MXML can do this because the compiler generates the class and can trap name duplication at compile time.
    Great question, BTW.
    -last edit changed my "attributes" to be "properties" in line with Adobe's terminology]

  • Image with text

    I have created an image with text (map with town names). The
    text is 12px Verdana bold. When I export to a gif (only a few
    colors) and show on a page I want to get the text to show clear
    when the page is resized. But it does not it becomes more obscure
    as it gets smaller. I have the image which I have styled
    {width:100%;height:100%;} to stop the image expanding the td it's
    in.
    Can anyone advise how best to achieve good font clarity in
    images that may be resized?
    thanks.

    ROGM wrote:
    > Can anyone advise how best to achieve good font clarity
    in images that may be
    > resized?
    Use Flash format, which is scalable. GIF's are not scalable.
    Linda Rathgeber [PVII] *Adobe Community Expert-Fireworks*
    http://www.projectseven.com
    Fireworks Newsgroup:
    news://forums.projectseven.com/fireworks/
    CSS Newsgroup: news://forums.projectseven.com/css/
    http://www.adobe.com/communities/experts/

  • How can i Display images with may own table

    Hi
    I want display images with my own table. How can I use in this query.
    SELECT    '<a href="#" onclick="javascript:'
           || 'getImageHeight(''my_img'
           || '#ROWNUM#'');javascript:redirect'
           || '(''f?p=&APP_ID.:212'
           || ':&SESSION.:DISPLAY:NO::P212_IMAGE_ID:'
           || ID
           || ''');">'
           || '<img src="#IMAGE_PREFIX#edit.gif" '
           || 'alt="Edit"></a>' ID,
              '<img id="my_img'
           || '#ROWNUM#" src="#WORKSPACE_IMAGES#'
           || filename
           || '"/>' image
      FROM wwv_flow_filesThanks
    Nr
    Edited by: user10966033 on Sep 28, 2009 1:41 PM

    You don't use #workspace_images# since that is for STATIC files, not images in a table..
    see this thread for help: Re: Display image from blob
    Thank you,
    Tony Miller
    Webster, TX

  • How can I use LCCS with ActionScript 3 and Flash CS4?

    Hi,
    Using Stratus I was able to create an an application using Action Script 3 and Flash CS4.  The sample code on the Adobe site was quite straight forward and easy to understand.  I now want to switch over to  LCCS but can't find anything any where on how to use Action Script 3 and Flash CS4 with LCCS.  Do I need to know Flex to be able to use LCCS?  Everything was quite simple and easy to understand with Stratus and makes complete sense.  But LCCS is really confusing.  Is there any sample code on how to establish a connection in Action Script 3 and then stream from a webcam to a client.  There is nothing in the  LCCS SDK that covers Flash and Action Script 3.  Please help!  I found the link below on some forum but it takes me nowhere.
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=72&catid=75 9&threadid=1407833&enterthread=y

    Thanks Arun!
    Date: Thu, 29 Apr 2010 11:44:10 -0600
    From: [email protected]
    To: [email protected]
    Subject: How can I use LCCS with ActionScript 3 and Flash CS4?
    Hi,
    Welcome to the LCCS world.
    Please refer to the SDK's sampleApps folder. There would be an app called FlashUserList. The app demonstrates how LCCS can be used with Flash CS4. Its a  pretty basic app, but should help you moving.
    We are trying to improve our efforts to help developers in understanding our samples. Please do let us know if we can add something that would help others.
    Thanks
    Arun
    >

Maybe you are looking for

  • How do I use the same track multiple times in different playlists? I want to rename it multiple times.

    Hi, I am an entertainer that want rename a track a music a number of different ways so it will come up in playlist that work alphabeticly. for instance: Good Song I want to change to: A Good Song B Good Song C Good Song D Good Song So I can place the

  • Help installing windows 8 on Macbook Pro 15"

    I recently downloaded Windows 8 64-bit for my mac from my University's Website for my new Mac. I tried using bootcamp assistant, but it wanted me to find the ISO image. I couldnt find this file in my downloads. After download was complete this "devic

  • Receiver file adapter not functioning

    Hi guys, We have developed some interfaces that are exporting some .txt files in ftp locations and therefore they make use of receiver file adapter. Although the receiver file adapter used to function properly some days ago, for some strange reason,

  • Music playing in speakers while my headphones are plugged

    I tried 2 different headphones and since yesterday, when it is plugged, i can still hear music or sounds coming from the speakers and i do not hear anything in my headphones...pretty annoying, any idea?

  • Trouble with SQL in JSTL

    I'm trying to learn to use the JSTL, but it isn't going so well. Using scriptlets, I wrote this JSP that works just fine: <HTML>      <HEAD>           <TITLE> <%= request.getParameter("txtTitle") %> </TITLE>           <%@ page import="java.sql.*, jav