Skip to content

Complete Event fires before last image is ready as blob #214

Open
@johnmastri

Description

@johnmastri

I created a manifest of images to load which calls handleImagesLoadComplete when complete. At this point it shows that the last image has, in theory, been loaded (queue.getItems()). However when createGrid() is called, which pulls in the images, the last image shows as undefined. I have been able to resolve this by adding a slight delay to, I'm guessing, compensate for the time it takes to convert the last image into a blob. Any idea what else it could be?

loadImages : function() {

        var queue_manifest = [];

        for(var a = 0 ; a < this.data.projects.length ; a++) {

            var d = this.data.projects[a];
            for(var b = 0 ; b < d.content.length ; b++) {

                var c = d.content[b];

                queue_manifest.push({
                    src: "image/case_studies/" + c.img
                })

            }

        }

        AP.queue.reset();
        AP.queue.on("complete", this.handleImagesLoadComplete, this);
        AP.queue.loadManifest(queue_manifest);

    },

    handleImagesLoadComplete : function(event) {

        event.remove();
        this.createGrid();

         //hacky fix - only shows the last image when a delay is added
        //$t.delayedCall(.1, this.createGrid, null, this);

    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions