Loading images from an Array generated from XML

OK, this is my first day trying to use AS3 and I'm kind of
confused on how to load an image onto the screen and then be able
to resize it, scale it, etc..
I'm loading up to 5 images in from an XML file that will be
generated on a server. (right now I'm just using a test.xml file).
Normally I would load the images into dynamically created
movie clips (whatever0_mc through whatever4_mc generated by code in
AS2). But I can't seem to get anything working.. I've looked on the
internet and read through some information but I'm still just
REALLY confused... this is what I have so far. To make it easier on
me in the future, I've put different code on different layers so I
can look at it closer.. I've separated the code into the different
layers they're on here:
First Layer:
import flash.events.Event;
import flash.net.URLLoader; // URL Loader Import for Images
import flash.net.URLRequest; // URL Requests Import for
Images
import flash.display.Loader; // Loader
import flash.events.ProgressEvent; // Progress for Loader
import flash.text.TextField; // Imports for Text Fields
import flash.display.Sprite; // Imports Sprite stuff for
loaded Images
import flash.display.Bitmap; // Imports stuff to display a
bitmap
Second Layer:
var imgLoader:Loader = new Loader(); // Initialize Image
Loader
// Listeners for the Image Loaders //
function showPreloader(evt:Event):void {
trace("-- ** showPreloader ** --");
addChild(loadProgress_txt);
function showProgress(evt:ProgressEvent):void {
trace("-- ** showProgress ** --");
var totalLoaded:Number = evt.bytesTotal;
var currentLoaded:Number = evt.bytesLoaded;
var thePercent:Number = (currentLoaded * 100) / totalLoaded;
loadProgress_txt.text = thePercent + "%"; // Show bytes
loaded
function showLoadResult(evt:Event):void {
trace("-- ** showLoadResult ** --");
Third Layer:
// Setup Variables //
var imageArray:Array = new Array();
var galleryTitle:String;
var numPhotos:Number;
var gallerySubmitter:String;
// XML Info //
XML.ignoreComments = true;
XML.ignoreWhitespace = true;
var galleryXML:XML;
var xmlLoader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest("test.xml");
xmlLoader.load(request);
xmlLoader.addEventListener(Event.COMPLETE, XMLComplete);
function XMLComplete(evt:Event):void {
trace("-- ** XMLComplete ** --");
var loader:URLLoader = evt.target as URLLoader;
if (loader != null){
galleryXML = new XML(loader.data);
galleryTitle = galleryXML.children()[0].attributes()[0];
numPhotos = galleryXML.children()[0].attributes()[1];
gallerySubmitter = galleryXML.children()[0].attributes()[2];
trace("galleryTitle: " + galleryTitle);
trace("numPhotos: " + numPhotos);
trace("gallerySubmitter: " + gallerySubmitter);
for(var i:Number = 0; i<numPhotos; i++) {
imageArray.push(galleryXML.children()[0].children()
.attributes()[1]);
} // for(var i:Number = 0; i<numPhotos; i++)
trace(imageArray.toString());
trace("loading: images\\gallery\\" + imageArray[0]);
var imgRequest:URLRequest = new
URLRequest("images\\gallery\\" + imageArray[0]); // Request the
Image into the Loader
imgLoader.load(imgRequest);
imgLoader.contentLoaderInfo.addEventListener(Event.OPEN,showPreloader);
imgLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,showProgress);
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,showLoadResult);
} else { // if (loader != null){
trace("loader is not a URLLoader!");
} // if (loader != null){
} // function onComplete(event:Event):void {
// End XML Info //
Can anyone point me in the next direction?
thanks...

When you used the IMAQ create VI you specified each image to use the same name of "image".  Each image has to have a unique name.  I edited your VI to give a unique name for each image and I was able to view three different images in three different viewing panes.
Attachments:
Image Array Reworked.vi ‏19 KB

Similar Messages

  • Load image dynamically by scripting to dynamic xml pdf, is it possible?

    Hi All,
    I've uploaded static pdf form to http://groups.google.com/group/livecycle/web/logo.pdf.
    The form contains ImageField.
    In the "docReady" event of the form I wrote a script:
    ImageField1.value.image.href="http://www.quicksoft.co.il/images/
    quicksoftlogo2.jpg";
    When the form is loaded the ImageField shows the image from the url
    I've updated in the script.
    Once the form is saved as dynamic xml pdf the script stop working.
    Is that means that it is not possible to load images by scripting to
    dynamic xml pdfs?
    Anyone familiar with workarounds for it?
    Thanks in advance,
    Rbuz

    I got an answer from Adobe:
    Dynamic change of an image href has been disabled due to potential security issues. There are however a few workarounds to choose from:
    1. Embedding the images in the form as hidden objects. They can then be set to visible on initialize or clicking a button. This will affect performance, but if the images are in a compressed format, this can be minimized.
    2. Create a Web service interface to grab the image from wherever they are stored, base64 encode it and return it to the form. You would also have to update the bindings for the image field on the form (a one time operation).

  • Web printing from a report generated from a bookmark

    Hi,
    I implemented the How to web printing last year.  Eveything worked fine until someone tried to print a report generated from a bookmark.  It opens the window where it shows the formatted report to be printed, but does not do anything else.  The window remains blank.  Anybody having an idea?  I am sure it is related with the bookmark stuff, but can not get the finger on it.
    Tks a lot,
    Guylaine

    Has the template that the bookmark is off of been changed?  That might be causing the problem. 
    Thanks,
    Jeff

  • Gif images in pdf file generated from Reports 6i

    Hello,
    When I generate pdf file from Reports Builder 6i and open this file with Acrobat Reader 5.0 I get that some of my gifs are black or other color.
    When I generate the same report to the live previewer everything is OK.
    Is it a Reports 6i bug? Any workarounds?
    Best regards
    Raimundas Katilius

    Hi
    If u generate the report output to PDF from the report
    GIF images doesn't show up properly . Generate it from the
    application then i think it will print clearly.
    If u try to print text followed by image and followed by text
    again PDF will not print
    I think this should help u
    Sri
    Hello,
    When I generate pdf file from Reports Builder 6i and open this file with Acrobat Reader 5.0 I get that some of my gifs are black or other color.
    When I generate the same report to the live previewer everything is OK.
    Is it a Reports 6i bug? Any workarounds?
    Best regards
    Raimundas Katilius

  • Unable to Display Background Graphic From HTML File Generated from AI File

    I am trying to figure out if this is a MAC OS X or Safari issue. I have already a message into the author of the plug-in as well as created a posting on the Adobe Forum.
    I am following a tutorial on Lynda.com called "Design the Web: Illustrator to Animated HTML5 Canvas." I am using a plug in called Ai2CanvasMac with Adobe Illustrator, It essentially generates an HTML file from an Illustrator file. The Illustrator file has an embedded PNG file as a background image and a small vector graphic in front and centered. After the plug-in generates the HTML file, it automatically opens the file up in the browser. This is where I am getting mixed results.
    Safari: The small vector does appear and in the center where the embedded background should appear. But the background image isn't displaying, only a white background is showing.
    Firefox and Chrome: The page is totally blank. Not even the vector graphic appears.
    It will work with two different approaches.
    1. If I edit the source image web links in HTML file and use links from any graphics I find off the web. That works fine. The images are displayed in the browser window.
    2. If I embedded PNG images from my desktop into the Illustrator file and generate the HTML file. That works fine too.
    Does anyone have any ideas as to why I can't the graphics to display properly in the browser without doing this workaround?

    Hi,
    Ex. 1 - If the Index file is in the same directory, called "test"
    tales/numbers.jpg
    Ex. 2 - If the image is in a subdirectory, called "test1" within "test"
    test/test1/numbers.jpg
    img src="test/test1/numbers.jpg"
    Regards
    Ayyapparaj

  • Load image data into array collection without ever displaying it

    Hi all,
    I am starting with a String that is a path to a local file. I
    need to add that image (png) to an array collection without ever
    displaying it on screen. What would be the most direct process to
    get it into the type BitmapData.
    No matter what i try, i cant seem to get the image to
    actually load into memory so it is available without displaying it
    on the screen. Thanks in advance,

    Hi Jed,
    In AIR, you can simply use FileStream's readBytes() call to
    read the contents of the image file into a bytearray. Now when you
    want to display the image, simply use Loader.loadBytes().
    Once the loadBytes() call completes, you will be able to get
    bitmap data. Till then it would be in JPG/PNG/GIF format.

  • How can I load images without XML, please?

    Hello Everyone,
    I would highly appreciate it if someone can point me into the right direction. I have some AS2 code which loads up the images via an xml file. I have been asked to eliminate XML entirely and have images be loaded from with in the library. Aside from images, there are other xml nodes such as:
    image_name, image_description and such.
    What would be the best way going about eliminating the XML and getting the code to load images and other related info from the library. I would highly appreciate your help on this, please.
    Thanks a lot.

    create arrays that contain the same info as the xml.
    p.s.  and, you'll use attachMovie() instead of loadMovie().

  • How to make collective purchase order from planorder generated from MRP

    Hi Experts,
    I have 2 queries are
    1) Is there any option to create collective Purchase order or Purchase requisition from Plan order generated from MRP ?
    for e.g one packaging material is use in different finish goods products when we run MRP on all finish goods its generates Plan order of FG and BOM. In  packaging material it dependent of 3 to 4 FG and its generate 3 or 4 different Plan order.
    It is possible to create collective PR or PO ?
    2) Is there any possibility to convert Plan order onto Purchase order by vendor , material and delivery date ?
        I have use ME59N and MD15 but its not useful for me.
    Thanks
    Farrukh khan

    Dear farrukh,
    when MRP run You should set mrp control parameter
    Create Purchase requisitions :- 1
    then after mrp run Purchase requisitions created.
    and
    we can change collective Purchase requisitions in to one Purchase order.
    go to selection variant in ME21N,
    then select Purchase requisitions and put all Purchase requisitions.
    and adopt and create Purchase order.
    but condition is it will create only same material and same vendor.
    Jainashu

  • Unable to generate the XML file through SQL script. getting error PLS-00306

    I am fetching the data from cursor and generating the xml output I am getting the below error.
    When I have checked the cursor query it is fetching the data in to single column.
    Input truncated to 1 characters
    Enter value for 7: EXEC FND_CONC_STAT.COLLECT;
    DBMS_LOB.append (tmp_file, r.core_xml);
    ERROR at line 95:
    ORA-06550: line 95, column 7:
    PLS-00306: wrong number or types of arguments in call to 'APPEND'
    ORA-06550: line 95, column 7:
    PL/SQL: Statement ignored

    Hi Alex,
    thanks for the responce..
    i have fixed the issue
    i have used XMLAttributes to get the value
    SELECT XMLELEMENT (
    NAME "TranACK",
    XMLAttributes ('1' as "TranNum",
    (select distinct to_char(SYSDATE,'yyyy-mm-dd')
    from DUAL) as "PrcDate"),
    XMLFOREST (
    a.PAYMENT_ID AS "PmtID"),
    XMLFOREST (
    a.ACK_TRANSACTION_RECEIVER AS "Name1"),
    XMLFOREST (
    to_char(a.VALUE_DATE,'yyyy-mm-dd') as "ValueDate" ),
    XMLFOREST (
    a.PAYMENT_AMOUNT AS "CurAmt"),
    XMLFOREST (
    a.CURRENCY_CODE AS "CurCode")
    ).getclobval ()
    AS line_xml
    FROM XXWAP_PAYMENT_LINE_TBL a
    where a.PAYMENT_BATCH_ID=P_batch_id;

  • Trouble loading images from XML files using AS

    I am creating a slideshow and found a script that will load
    the images via an XML document, but I believe the script is for an
    absolute references image such as <a href="
    http://www.myimages.com/image1.jpg">
    and I want to be able to have them in a file and reference the file
    in the XML such as :
    <pic>
    <image>images/04_02.jpg</image>
    <caption>Soleil Center 4</caption>
    </pic>
    When I test movie I get an error
    Error opening URL "path_to_image/01_02.jpg"
    Is there something I need to change in the AS to be able to
    reference a folder on my desktop (in the same directory as .fla
    file).
    here is the AS code:
    function loadXML(loaded) {
    if (loaded) {
    xmlNode = this.firstChild;
    image = [];
    description = [];
    total = xmlNode.childNodes.length;
    for (i=0; i<total; i++) {
    image
    = xmlNode.childNodes.childNodes[0].firstChild.nodeValue;
    description
    = xmlNode.childNodes.childNodes[1].firstChild.nodeValue;
    firstImage();
    } else {
    content = "file not loaded!";
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("images.xml");
    listen = new Object();
    listen.onKeyDown = function() {
    if (Key.getCode() == Key.LEFT) {
    prevImage();
    } else if (Key.getCode() == Key.RIGHT) {
    nextImage();
    Key.addListener(listen);
    previous_btn.onRelease = function() {
    prevImage();
    next_btn.onRelease = function() {
    nextImage();
    p = 0;
    this.onEnterFrame = function() {
    filesize = picture.getBytesTotal();
    loaded = picture.getBytesLoaded();
    preloader._visible = true;
    if (loaded != filesize) {
    preloader.preload_bar._xscale = 100*loaded/filesize;
    } else {
    preloader._visible = false;
    if (picture._alpha<100) {
    picture._alpha += 10;
    function nextImage() {
    if (p<(total-1)) {
    p++;
    if (loaded == filesize) {
    picture._alpha = 0;
    picture.loadMovie(image[p], 1);
    desc_txt.text = description[p];
    picture_num();
    function prevImage() {
    if (p>0) {
    p--;
    picture._alpha = 0;
    picture.loadMovie(image[p], 1);
    desc_txt.text = description[p];
    picture_num();
    function firstImage() {
    if (loaded == filesize) {
    picture._alpha = 0;
    picture.loadMovie(image[0], 1);
    desc_txt.text = description[0];
    picture_num();
    function picture_num() {
    current_pos = p+1;
    pos_txt.text = current_pos+" / "+total;
    }

    something is still amiss here becuase I placed the xml and
    images at the root level and the images still do not load. I don't
    get any kind of error and Trace tells me the file is being loaded.
    took out the /images/ part so that in the XML it's now :
    <pic>
    <image>07_02.jpg</image>
    <caption>Image Description</caption>
    </pic>
    and here is the AS code:
    var image:Array = new Array();
    var description:Array = new Array();
    function loadXML(loaded) {
    if (loaded) {
    var xmlNode:XMLNode = this.firstChild;
    var total:Number = xmlNode.childNodes.length;
    for (var i:Number = 0; i<total; i++) {
    image.push(xmlNode.childNodes
    .childNodes[0].firstChild.nodeValue);
    description.push(xmlNode.childNodes.childNodes[1].firstChild.nodeValue);
    trace('File Name Value: '+xmlNode.childNodes);
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("images.xml");
    listen = new Object();
    listen.onKeyDown = function() {
    if (Key.getCode() == Key.LEFT) {
    prevImage();
    } else if (Key.getCode() == Key.RIGHT) {
    nextImage();
    Key.addListener(listen);
    previous_btn.onRelease = function() {
    prevImage();
    next_btn.onRelease = function() {
    nextImage();
    p = 0;
    this.onEnterFrame = function() {
    filesize = picture.getBytesTotal();
    loaded = picture.getBytesLoaded();
    preloader._visible = true;
    if (loaded != filesize) {
    preloader.preload_bar._xscale = 100*loaded/filesize;
    } else {
    preloader._visible = false;
    if (picture._alpha<100) {
    picture._alpha += 10;
    function nextImage() {
    if (p<(total-1)) {
    p++;
    if (loaded == filesize) {
    picture._alpha = 0;
    picture.loadMovie(image[p], 1);
    desc_txt.text = description[p];
    picture_num();
    function prevImage() {
    if (p>0) {
    p--;
    picture._alpha = 0;
    picture.loadMovie(image[p], 1);
    desc_txt.text = description[p];
    picture_num();
    function firstImage() {
    if (loaded == filesize) {
    picture._alpha = 0;
    picture.loadMovie(image[0], 1);
    desc_txt.text = description[0];
    picture_num();
    function picture_num() {
    current_pos = p+1;
    pos_txt.text = current_pos+" / "+total;
    }

  • Load images from XML to specific movieclip

    I'm still begginer. I have to load images in specific movieclip, because they're loading over all the other layers. What should I do?
    I made a simple slideshow by tutorial.
    I guess it would be better that I show all the code not specific parts:
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    import fl.transitions.TweenEvent;
    var my_speed:Number;
    var my_total:Number;
    var my_images:XMLList;
    var my_loaders_array:Array=[];
    var my_labels_array:Array=[];
    var my_success_counter:Number=0;
    var my_playback_counter:Number=0;
    var my_slideshow:Sprite = new Sprite();
    var my_image_slides:Sprite = new Sprite();
    var my_label_slides:Sprite = new Sprite();
    var my_preloader:TextField;
    var my_timer:Timer;
    var my_prev_tween:Tween;
    var my_tweens_array:Array=[];
    var my_xml_loader:URLLoader = new URLLoader();
    my_xml_loader.load(new URLRequest("sshow.xml"));
    my_xml_loader.addEventListener(Event.COMPLETE, processXML);
    function processXML(e:Event):void {
        var my_xml:XML=new XML(e.target.data);
        my_speed=my_xml.@SPEED;
        my_images=my_xml.IMAGE;
        my_total=my_images.length();
        loadImages();
        my_xml_loader.removeEventListener(Event.COMPLETE, processXML);
        my_xml_loader=null;
    function loadImages():void {
        for (var i:Number = 0; i < my_total; i++) {
            var my_url:String=my_images[i].@URL;
            var my_loader:Loader = new Loader();
            my_loader.load(new URLRequest(my_url));
            my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
            my_loaders_array.push(my_loader);
        my_preloader = new TextField();
        my_preloader.text="Loading";
        my_preloader.autoSize=TextFieldAutoSize.CENTER;
        my_preloader.x = (stage.stageWidth - my_preloader.width)/2;
        my_preloader.y = (stage.stageHeight - my_preloader.height)/2;
        addChild(my_preloader);
    function onComplete(e:Event):void {
        my_success_counter++;
        if (my_success_counter==my_total) {
            startShow();
        var my_loaderInfo:LoaderInfo=LoaderInfo(e.target);
        my_loaderInfo.removeEventListener(Event.COMPLETE, onComplete);
    function startShow():void {
        removeChild(my_preloader);
        my_preloader=null;
        addChild(my_slideshow);
        my_slideshow.addChild(my_image_slides);
        nextImage();
        my_timer=new Timer(my_speed*1000);
        my_timer.addEventListener(TimerEvent.TIMER, timerListener);
        my_timer.start();
    function nextImage():void {
        var my_image:Loader=Loader(my_loaders_array[my_playback_counter]);
        my_image_slides.addChild(my_image);
        my_image.x = (stage.stageWidth - my_image.width)/2;
        my_image.y = (stage.stageHeight - my_image.height-20)/2;
        my_tweens_array[0]=new Tween(my_image,"alpha",Strong.easeOut,0,1,2,true);
    function timerListener(e:TimerEvent):void {
        hidePrev();
        my_playback_counter++;
        if (my_playback_counter==my_total) {
            my_playback_counter=0;
        nextImage();
    function hidePrev():void {
        var my_image:Loader=Loader(my_image_slides.getChildAt(0));
        my_prev_tween=new Tween(my_image,"alpha",Strong.easeOut,1,0,2,true);
        my_prev_tween.addEventListener(TweenEvent.MOTION_FINISH, onFadeOut);
    function onFadeOut(e:TweenEvent):void {
        my_image_slides.removeChildAt(0);

    I don't see a problem in the code you provided. All the pictures are put in single one MovieClip, my_image_slides. Of course, there can be only one DisplayObject in a DisplayObjectContainer's layer (depth), so when you call function addChild again and again, the child displayObjects keep stacking up one on the other. I found one strange thing though:
    my_tweens_array[0]=new Tween(my_image,"alpha",Strong.easeOut,0,1,2,true);
    Why would you create an array just to limit it to one item and overwrite it every time? I would use this instead:
    my_tweens_array.push(new Tween(my_image,"alpha",Strong.easeOut,0,1,2,true));
    Can you upload it somwhere so we can see it in action? At this point I can only guess what the problem is.

  • How do i load images from a folder?

    Hello everyone,
    Please can someone help me as i am stuck.
    I am trying to research loading images from a folder called /images/unknown (unknown is a customer number and is stored in a variable called customerNo).
    I feel that i will need to load the images into an array then display them to the screen with a viewer.
    Can anybody help me.
    Thanks in advance

    Welcome to the Sun forums.
    irknappers wrote:
    ...Please can someone help me as i am stuck.You might want to be more exact in future, about what you are stuck on.
    import javax.imageio.ImageIO;
    import java.io.FileFilter;
    import java.io.File;
    import javax.swing.JFileChooser;
    class LoadImages {
        public static void main(String[] args) {
            String[] suffixes = ImageIO.getReaderFileSuffixes();
            FileFilter fileFilter = new FileFilterType(suffixes);
            File directory = null;
            if (args.length==1) {
                directory = new File( args[0] );
            } else {
                JFileChooser fileChooser = new JFileChooser();
                fileChooser.setFileSelectionMode( JFileChooser.DIRECTORIES_ONLY );
                int result = fileChooser.showOpenDialog( null );
                if ( result == JFileChooser.APPROVE_OPTION ) {
                    directory = fileChooser.getSelectedFile();
                } else {
                    System.err.println("Must select a directory to proceed, exiting.");
            File[] images = directory.listFiles( fileFilter );
            for (File file : images) {
                System.out.println(file);
            System.out.println( "The rest is left an exercise for the reader.  ;-)" );
    class FileFilterType implements FileFilter {
        String[] types;
        FileFilterType(String[] types) {
            this.types = types;
        public boolean accept(File file) {
            for (String type : types) {
                if ( file.getName().toLowerCase().endsWith( type.toLowerCase() ) ) {
                    return true;
            return false;
    }

  • Generating an XML Document from an internal table in ABAP

    Good day to all of you;
    With ABAP, in the R/3 system, I'm trying to figure out a way to accomplish the following:
    1) SELECT a set of Purchase Order data into an internal table.
    2) Generate an XML document, containing the above data, using a specific schema.
    I've been playing around with function module SAP_CONVERT_TO_XML_FORMAT which has the following interface:
    CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
          EXPORTING
          I_FIELD_SEPERATOR    = ''
          I_LINE_HEADER        = ''
            I_FILENAME           = v_fname
          I_APPL_KEEP          = ''
          I_XML_DOC_NAME      = v_docname
          IMPORTING
            PE_BIN_FILESIZE      = v_byte
          TABLES
            I_TAB_SAP_DATA       = i_SapData
          CHANGING
            I_TAB_CONVERTED_DATA = i_XMLData
          EXCEPTIONS
            CONVERSION_FAILED    = 1
            OTHERS               = 2.
    I'm uncertain as to whether or not the Export parameter, I_XML_DOC_NAME refers to some schema or definition and therefore have been excluding it.  In doing so, the generated XML document seems to use the field name/type information from my itab for the tags.
    If this function module requires an XML Document Name, how do I create one and where do I store it in R/3?  If this is not the recommended solution, is anyone familiar with a way to load an XML schema, retrieve some data then have SAP generate an XML document using the schema?
    Many thanks for any help available.
    T

    Hai Phillips
    Try with the following Code
    This program exports an internal table to an XML file.
    Report ZPRUEBA_MML_13 *
    Export an internal table to XML document *
    NO BORRAR ESTE CODIGO *
    REPORT ZPRUEBA_MML_13.
    PANTALLA SELECCION *
        PARAMETERS: GK_RUTA TYPE RLGRAP-FILENAME.
    PANTALLA SELECCION *
    TYPE TURNOS *
    TYPES: BEGIN OF TURNOS,
        LU LIKE T552A-TPR01,
        MA LIKE T552A-TPR01,
        MI LIKE T552A-TPR01,
        JU LIKE T552A-TPR01,
        VI LIKE T552A-TPR01,
        SA LIKE T552A-TPR01,
        DO LIKE T552A-TPR01,
    END OF TURNOS.
    TYPE TURNOS *
    TYPE SOCIO *
    TYPES: BEGIN OF SOCIO,
        NUMERO LIKE PERNR-PERNR,
        REPOSICION LIKE PA0050-ZAUVE,
        NOMBRE LIKE PA0002-VORNA,
        TURNOS TYPE TURNOS,
    END OF SOCIO.
    TYPE SOCIO *
    ESTRUCTURA ACCESOS *
    DATA: BEGIN OF ACCESOS OCCURS 0,
        SOCIO TYPE SOCIO,
    END OF ACCESOS.
    ESTRUCTURA ACCESOS *
    START OF SELECTION *
    START-OF-SELECTION.
        PERFORM LLENA_ACCESOS.
        PERFORM DESCARGA_XML.
    END-OF-SELECTION.
    END OF SELECTION *
    FORM LLENA_ACCESOS *
    FORM LLENA_ACCESOS.
    REFRESH ACCESOS.
    CLEAR ACCESOS.
    MOVE: '45050' TO ACCESOS-SOCIO-NUMERO,
                  'MOISES MORENO' TO ACCESOS-SOCIO-NOMBRE,
                  '0' TO ACCESOS-SOCIO-REPOSICION,
                  'T1' TO ACCESOS-SOCIO-TURNOS-LU,
                  'T2' TO ACCESOS-SOCIO-TURNOS-MA,
                  'T3' TO ACCESOS-SOCIO-TURNOS-MI,
                  'T4' TO ACCESOS-SOCIO-TURNOS-JU,
                  'T5' TO ACCESOS-SOCIO-TURNOS-VI,
                  'T6' TO ACCESOS-SOCIO-TURNOS-SA,
                  'T7' TO ACCESOS-SOCIO-TURNOS-DO.
    APPEND ACCESOS.
    CLEAR ACCESOS.
    MOVE: '45051' TO ACCESOS-SOCIO-NUMERO,
                  'RUTH PEÑA' TO ACCESOS-SOCIO-NOMBRE,
                  '0' TO ACCESOS-SOCIO-REPOSICION,
                  'T1' TO ACCESOS-SOCIO-TURNOS-LU,
                  'T2' TO ACCESOS-SOCIO-TURNOS-MA,
                  'T3' TO ACCESOS-SOCIO-TURNOS-MI,
                  'T4' TO ACCESOS-SOCIO-TURNOS-JU,
                  'T5' TO ACCESOS-SOCIO-TURNOS-VI,
                  'T6' TO ACCESOS-SOCIO-TURNOS-SA,
                  'T7' TO ACCESOS-SOCIO-TURNOS-DO.
    APPEND ACCESOS.
    ENDFORM.
    FORM LLENA_ACCESOS *
    FORM DESCARGA_XML *
    FORM DESCARGA_XML.
    DATA: L_DOM TYPE REF TO IF_IXML_ELEMENT,
                  M_DOCUMENT TYPE REF TO IF_IXML_DOCUMENT,
                  G_IXML TYPE REF TO IF_IXML,
                  W_STRING TYPE XSTRING,
                  W_SIZE TYPE I,
                  W_RESULT TYPE I,
                  W_LINE TYPE STRING,
                  IT_XML TYPE DCXMLLINES,
                  S_XML LIKE LINE OF IT_XML,
                  W_RC LIKE SY-SUBRC.
    DATA: XML TYPE DCXMLLINES.
    DATA: RC TYPE SY-SUBRC,
    BEGIN OF XML_TAB OCCURS 0,
                  D LIKE LINE OF XML,
    END OF XML_TAB.
    CLASS CL_IXML DEFINITION LOAD.
    G_IXML = CL_IXML=>CREATE( ).
    CHECK NOT G_IXML IS INITIAL.
    M_DOCUMENT = G_IXML->CREATE_DOCUMENT( ).
    CHECK NOT M_DOCUMENT IS INITIAL.
    WRITE: / 'Converting DATA TO DOM 1:'.
    CALL FUNCTION 'SDIXML_DATA_TO_DOM'
    EXPORTING
                  NAME = 'ACCESOS'
                  DATAOBJECT = ACCESOS[]
    IMPORTING
                  DATA_AS_DOM = L_DOM
    CHANGING
                  DOCUMENT = M_DOCUMENT
    EXCEPTIONS
                  ILLEGAL_NAME = 1
                  OTHERS = 2.
    IF SY-SUBRC = 0.
                  WRITE 'Ok'.
    ELSE.
                  WRITE: 'Err =',
                  SY-SUBRC.
    ENDIF.
    CHECK NOT L_DOM IS INITIAL.
    W_RC = M_DOCUMENT->APPEND_CHILD( NEW_CHILD = L_DOM ).
    IF W_RC IS INITIAL.
                  WRITE 'Ok'.
    ELSE.
                  WRITE: 'Err =',
                  W_RC.
    ENDIF.
    CALL FUNCTION 'SDIXML_DOM_TO_XML'
    EXPORTING
                  DOCUMENT = M_DOCUMENT
    IMPORTING
                  XML_AS_STRING = W_STRING
                  SIZE = W_SIZE
    TABLES
                  XML_AS_TABLE = IT_XML
    EXCEPTIONS
                  NO_DOCUMENT = 1
                  OTHERS = 2.
    IF SY-SUBRC = 0.
                  WRITE 'Ok'.
    ELSE.
                  WRITE: 'Err =',
                  SY-SUBRC.
    ENDIF.
    LOOP AT IT_XML INTO XML_TAB-D.
                  APPEND XML_TAB.
    ENDLOOP.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
                  BIN_FILESIZE = W_SIZE
                  FILENAME = GK_RUTA
                  FILETYPE = 'BIN'
    TABLES
                  DATA_TAB = XML_TAB
    EXCEPTIONS
                  OTHERS = 10.
    IF SY-SUBRC <> 0.
                  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.
    FORM DESCARGA_XML *
    Thanks & regards
    Sreenivasulu P

  • Loader will load images from another server, but then we get error on Bitmap operation

    I'm developing an app that currently is using Loader to get images from another server.  This shouldn't currently work since we are still waiting for the owner of that server to put a crossdomain file in place.  However, it does work -- sort of .
    Loader can load the images fine, without an error.  But then the app has a feature in which we are making a larger duplicate of the image to display in a sidebar, we do this in this manner:
    var myBitmap:Bitmap = Bitmap(loader.content);
    and when this runs we get a Flash player security error 2122, sandbox violation.
    So while I'm hoping all this will fix itself when the crossdomain.xml file is put in place, I'm confused as to why we only get the sandbox error when we make a Bitmap from the image, and not when we initially try to retrieve the image.
    (Incidentally: is there a better way to make a "copy" of an image loaded by a Loader, and then change its width and height for simultaneous display in another part of the stage?  I don't need to change its actual dimensions -- I just need to change its display width and height.)
    Thanks!

    The sandbox allows viewing, not editing from another server without a crossdomain.
    So, when you try to load it up, it loads it, but "read-only" and gives you an error when you try to "edit" it by making a new Bitmap out of it.
    This should resolve itself once that crossdomain is in place.
    ||EDIT||
    I just realized I should clarify my statement a little more.
    When you load images from another server without a crossdomain, it allows the load for display only.  When you try to load data, it will fail.  This is because, XML data, or some other type of data is editable by default, and images are only viewable by default.  So, the image fails when you try to convert it into an editable form.

  • How to load images from client side when the swf is hosted on a server without uplaoding it to server?

    I'm trying to build a online image resize tool.
    problem i face are:
    1. I build a button that allow user to browse the file. Once
    file is selected, it doesnt show full path.
    2. lets say if it shows fullpath, but i try to load it into a
    movieclip, and it doesnt work because the swf file is located at
    the server and not the client's place.
    3. as far as i know, flash can only load images which is
    located in the same server or internet.
    4. if i use php, asp, cgi.. it can only allow me to 1st
    upload the image then resize later, but this is not wat i want.
    5. I need to 1st resize then upload later, because if i have
    100 and more photos taken from digicam, it's going to be very slow
    and heavy.
    What i have tested:
    1. upload "image3.jpg" into the same directory as the
    "viewer.swf", and it works.
    2. do not upload the swf to the server, but run locally from
    the user's computer and open "image3.jpg" and it works.
    3. upload the swf to the server and open "image3.jpg" from
    the user's computer and IT DOESN"T WORK!
    please help me out.
    Thanks~!

    use this php code.
    for flash php image prosses.
    flash file
    import flash.display.BitmapData;
    shaF.onPress = function() {
    output();
    function output() {
    snap = new BitmapData(mc._width, mc._height);
    snap.draw(mc);
    var pixels:Array = new Array();
    var w:Number = snap.width;
    var h:Number = snap.height;
    for (var a = 0; a<=w; a++) {
    for (var b = 0; b<=h; b++) {
    var tmp = snap.getPixel(a, b).toString(16);
    pixels.push(tmp);
    var output:LoadVars = new LoadVars();
    output.img = pixels.toString();
    output.height = h;
    output.width = w;
    output.send("show.php", "output", "POST");
    stop();
    PHP file (show.php)
    <?php
    $data = explode(",", $_POST['img']);
    $width = $_POST['width'];
    $height = $_POST['height'];
    $image=imagecreatetruecolor( $width ,$height );
    $background = imagecolorallocate( $image ,0 , 0 , 0 );
    //Copy pixels
    $i = 0;
    for($x=0; $x<=$width; $x++){
    for($y=0; $y<=$height; $y++){
    $int = hexdec($data[$i++]);
    $color = imagecolorallocate ($image, 0xFF & ($int
    >> 0x10), 0xFF & ($int >> 0x8), 0xFF & $int);
    imagesetpixel ( $image , $x , $y , $color );
    //$font = imageloadfont('arial.ttf');
    $font = 'arial.ttf';
    // $text_color = imagecolorallocate($image, 233, 14, 91);
    $black = imagecolorallocate($image, 0, 0, 0);
    //imagestring($image, $font, 5, 5, "A Simple Text String",
    $text_color);
    imagettftext($image, 12, 0, 10, 20, $black, $font, "A Simple
    Text String");
    //Output image and clean
    //header("Content-Type: image/png");
    imagepng($image,"finoy.png");
    imagedestroy( $image );
    ?>
    <html>
    <body>
    <img src="finoy.png" width="159" height="159" />
    </body>
    </html>

Maybe you are looking for