How to swap the source image of a MC programmatically in AS3?

This seems like it would be a simple thing.
I have converted a jpeg to a movie clip that I want to be able to swap out the image source programmatically in the code behind.
This can be done easily in the GUI. How do you do it programmatically?
I have been searching for hours now and have not found anything that discusses how to do this.
pseudo code:
var my_image = "my_image.jpg";
my_mc.SwapSource = my_image;

Thanks for the reply. Please allow me to elaborate further. I set the class name in the linkage section of the bitmap properties dialog box as you suggested using the format pic1, pic2, pic3....and so on for each of my images in the library. I want to assign these randomly to my movie clips, topImage and botImage respectively.
Following is my code:
// number of images
var myImageSequence = 12;
// assign a rectangular mask to the top image
topImage.mask = mcMask;
btnSubmit.addEventListener(MouseEvent.CLICK, mouseClickButton);
function mouseClickButton(e:Event) {
var myRandomNumber1 = Math.floor(Math.random()*myImageSequence)+1;
var myRandomNumber2 = Math.floor(Math.random()*myImageSequence)+1;
var myImageName1 = "pic" + myRandomNumber1;
var myImageName2 = "pic" + myRandomNumber2;
topImage.addChild (myImageName1);
botImage.addChild (myImageName2);
Following is the error:
TypeError: Error #1034: Type Coercion failed: cannot convert "pic10" to flash.display.DisplayObject.

Similar Messages

  • How to get the source of a strange posted pic into my camera roll?

    I got a strange pic put into my camera roll, this pic is most likely put by an app which has an access to my photo gallery, all I want to know is how to get the source which put this image into my camera roll, I have a punch of apps that have a photo access grant and really don't know to disable all of these apps because of only one of them.
    p.s: the apps with photo access in my device (ProCam, CameraArtFXFree, Photo Editior-, Instagram, Poster++, Photo Vault, Facebook, Tango, Viber, Y! Messenger, Ipadio, Line, WhatsApp) And the only opened apps when this photo pushed to my Camera Roll were (Viber, Tango, Line, Whatsapp).
    Thanks in advance.

    >
    Nitesh Kumar wrote:
    > Hi,
    >
    > FM to get the program source code: RPY_PROGRAM_READ
    >
    > By using this FM you can get the program name(say report_name) and then you can use
    >
    > READ REPORT report_name INTO itab
    >
    > Thanks
    > Nitesh
    u dont need the last statement the FM itself returns an itab with code in it.

  • How to put the background image in Title Window?

    Hi,
    I'm newbie in flex. I 'm using Flex 4.
    Can anyone give me some guidelines on how to put the background image in Title Window?
    Is it possible to do this?
    Thanks.

    Hi,
    Check the below sample code
    <?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">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <fx:Style>
            @namespace s "library://ns.adobe.com/flex/spark";
            @namespace mx "library://ns.adobe.com/flex/mx";
            s|BorderContainer {
                background-image:Embed(source="image/wheres_the_green_rez.jpg");
                background-image-fill-mode:clip;
        </fx:Style>
        <s:TitleWindow width="100%" height="100%">
            <s:BorderContainer width="100%" height="100%"/>
        </s:TitleWindow>
    </s:Application>
    Regards,
    Anitha

  • How to get the source code of  "com.sap.caf.eu.gp.example.tiimeoff.wd.creat

    Hi Frendz..
    I want to know how we can build a callable obj which have a two buttons those r Accept n Reject accordiing to the actions on these buttons flow should forward to next screen(approver ) r sent back to the sender(screen with reject).
    I gone thru the Leave process(Time-Off process) which is very suitable for my requirment but in this app there r using predefined CO(com.sap.caf.eu.gp.example.tiimeoff.wd.create).How we see the source code of this predefined CO.
    Thanks in Advance
    Regards
    Rajesh

    Hi,
    check [this|Re: Source of Time-off Request Project].
    Regards,
    Naga

  • How to find the source code of com.sap.caf.eu.gp.example.tiimeoff.wd.create

    Hi Frendz..
    I want to know how we can build a callable obj which have a two buttons those  r Accept n Reject accordiing to the actions on these buttons flow should forward to next screen(approver ) r sent back to the sender(screen with reject).
    I gone thru the Leave process(Time-Off process) which is very suitable for my requirment but in this app there r using predefined CO(com.sap.caf.eu.gp.example.tiimeoff.wd.create).How we see the source code of this predefined CO.
    Thanks in Advance
    Regards
    Rajesh

    not answered

  • How to locate the source code which populate the SO number?

    Hi,
    For example:
    In T-code: VA01
    Put your cusor on the screen field : Standard Order
    Then press F1, get the technical info of this field as below shows:
    Screen field     VBAK-VBELN
    Program name     SAPMV45A
    Screen no.       4001
    So my question is, how to locate the source code which exactly to populate the SO number into VBAK-VBELN by the system automaticallly.
    As assumed that the system is generate this kind of SO autuomatically, and its number range is defined in SPRO.
    I just want to find out the coding part which gengerate the SO number.
    Want to see the source code of that...
    How to find it???
    Thanks.

    Hi Deepak,
    Thanks for the info..
    But i think i am also know that.
    Questions is dont know how to find the KEY statements that exactlly to generate the number...
    Anyway, 2 points to you.

  • How to view the source code for Native Method

    hi
    i am using some native methods in to my code ;
    can anybody tell me how to view the source code for the same ;
    nik

    Buy/acquire a C/C++/assembly code disassembler and run the shared library through it.

  • How to read the source code

    Hi,
    I want to know how to read the source code of web dynpro java from the source folder i.e. without loading the project in NWDS. Please answer me as soon as possible.
    Thanks & Regards,
    Aniruddha

    Hi,
    If you are using DC's then you can find the .Java files in the path
    <project Name>\_comp\gen_wdp\packages\<Pacjage>\<ComponentName>\..
    In the above path you can find the Java files of the controllers.
    Thanks,
    Raju Bonagiri

  • How to get the source code of Java Concurrent Program?

    Hi,
    How to get the source code of Java Concurrent Program?
    Example
    Programe Name:Format Payment Instructions
    Executable:Format Payment Instructions
    Execution File Name:FDExtractAndFormatting
    Execution File Path:oracle.apps.iby.scheduler
    Thanks in advance,
    Senthil

    Go on Unix box at $JAVA_TOP/oracle/apps/iby/scheduler
    You will get class file FDExtractAndFormatting.
    Decompile it to get source code.
    Thanks, Avaneesh

  • How to get the source code of a PRT application in the portal

    Hi!
    Does anybody know how to get the source code of a PRT application in the portal?
    Thanks in advance,
    Celso

    Celso,
    If its Java-based code have a look at the properties of an iView that belongs to the application in question and copy the value of the Code Link parameter e.g. 'com.sap.pct.hcm.rc_vacancyrequestov.default'.
    Search the Portal installation directory under /j233/cluster/server/ for a .par.bak file of the same name, removing .default from the codelink parameter
    e.g. com.sap.pct.hcm.rc_vacancyrequestov.par.bak
    Copt this locally and import into Netweaver Developer Studio. You will have to decompilte the class files with a decompiler such as DJ Decompiler or Cavaj (search with Google).
    Cheers,
    Steve

  • How to get the source code of an HTML page in Text file Through J2EE

    How to get the source code of an HTML page in Text file Through J2EE?

    Huh? If you want something like your browser's "view source" command, simply use a URLConnection and read in the data from the URL in question. If the HTML page is instead locally on your machine, use a FileInputStream. There's no magic invovled either way.
    - Saish

  • How to get the source code of an HTML page in Text file Through java?

    How to get the source code of an HTML page in Text file Through java?
    I am coding an application.one module of that application is given below:
    The first part of the application is to connect our application to the existing HTML form.
    This module would make a connection with the HTML page. The HTML page contains the coding for the Form with various elements. The form may be a simple form with one or two fields or a complex one like the form for registering for a new Bank Account or new email account.
    The module will first connect through the HTML page and will fetch the HTML code into a Text File so that the code can be further processed.
    Could any body provide coding hint for that

    You're welcome. How about awarding them duke stars?
    edit: cheers!

  • Where to  find the pcui_gp  components ,How to get the source code of those

    Hi All,
    Can anybody tell the exact location wher the pcui_gp components will be stored if they are  not appearing.
    And another question is how to get the source code of the pcui_gp for customization.
    anybody working on these compoents please help me.
    answers will be rewarded.
    thanks and regards,
    anand

    Hi Arun,
    I am unable to see the pcui_gp components in the DTR ,I require this in order to get the source code of one of its component.
    Can you please tell me the step by step procedure getting those pcui_gp components from J2ee engine to the  dtr or  NWDI.
    If there are any documents on pcui_gp components exclusively please do forward to my mail id [email protected]
    Thansk and Regards,
    Anand.

  • How to get the full image directory when i upload the image to web page???

    hai, how to get the full image directory when i upload the image to web page???
    here is the example:
    <form action="uploadfile.jsp" method="post">
    image<input type="file" name="image" />
    <input type="submit" value="submit"/>
    <%
    String s=request.getParameter("image");
    %>
    <%=s%>
    </form>
    i upload the image from C:\image\center.gif. i use request.getParameter just can get the image name like "center.gif". Can anybody help me how to get the full path name. Thanks a lot..

    There is no need to get the path. It is also fairly pointless as the server cannot access the client's local file system.
    Carefully read this article how you can upload files the right way: http://balusc.blogspot.com/2007/11/multipartfilter.html

  • How to change the source ip address

    hi all,
    i got the problem that how to change the source ip address when i
    get a website's page!
    i mean i want to change the source ip address when i access the
    remote website, sure i know when change the source ip, i can not get
    the result correctly when changing the source ip address, but it is not
    important to get the result i just want to send out a "click" event to the website by calling a post method in the site!
    does anybody have some ideas?
    Best Regards,
    Eric Gau

    Here's some code that connects to google and does a get:
    import java.io.*;
    import java.net.*;
    public class HTTPTest {
        private Socket sock;
        private BufferedReader in;
        private BufferedWriter out;
        private boolean running = false;
        HTTPTest() {
        private void go(String site) {
            try {
                sock = new Socket(site, 80);
                in = new BufferedReader(new InputStreamReader(sock.getInputStream()));
                out = new BufferedWriter(new OutputStreamWriter(sock.getOutputStream()));
                System.out.println("Connected");
                out.write("GET / HTTP/1.1\r\n\r\n");
                out.flush();
                doRead();
            } catch (IOException e) {
                e.printStackTrace();
        private void doRead() {
            running = true;
            String line;
            System.out.println("Read started");
            while (running) {
                try {
                    line = in.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                    line = null;
                if (line == null) {
                    running = false;
                } else {
                    System.out.println(line);
            System.out.println("Socket closed");
        public static void main(String [] args) {
            String site;
            if (args.length > 0) {
                site = args[0];
            } else {
                site = "google.ca";
            new HTTPTest().go(site);
    }

Maybe you are looking for

  • My iphone is not recognised by iTunes on Windows 8.1

    My iPhone is not recognised by iTunes since the Windows 8.1 update?

  • How to re-activate Photoshop CS2 after my hard drive was replaced

    Help! My hard drive had to be replaced, and now my computer will not allow me to use my Photoshop CS2. I purchased this years ago, and have all of the verification codes. I have several things I am working on that I can't finish until I get it reacti

  • Pie chart legend should display values and percents

    Hi All, Can any body suggest me how to display values and percent in pie chart legend.Thanks in advance. Edited by: 997414 on Apr 1, 2013 11:25 PM

  • Upgrade query

    Suppose I have a single license Master Collection CS5.5 suite. Can I purchase 3 upgrades to CS6(one in Home, second in Office and third on my Laptop)? I know that Upgrade from retail version to Volume Licensing is valid, but can I upgrade under Retai

  • Performance of the Insertion

    Hi, I have a procedure which inserts 3 million Records into the table. Whole insertion process is taking 15-17 minutes . Oracle version  :- Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit I have tried using Bulk Collect with Limit 5