Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

Load Pixellation Image Gallery into a swf

This is a discussion on Load Pixellation Image Gallery into a swf within the HELP free utilities forums, part of the Flash CS3 eng category; Hello Flep, I liked a lot your Pixellation Image Gallery but I'm having issues trying to add it in ...


Go Back   Forum Flash CS3 Flash CS4 > English Forums > Flash CS3 eng > HELP free utilities

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-01-08, 10:19
Junior Member
 
Join Date: Jan 2008
Posts: 5
Rep Power: 0
Equylybra is on a distinguished road
Load Pixellation Image Gallery into a swf

Hello Flep,

I liked a lot your Pixellation Image Gallery but I'm having issues trying to add it in a project I'm working. I saw you saying in another thread that this gallery was intended to be embed in a html file but my project require it to be loaded in a main swf. I decided to open this new thread hoping we could find a solution. Its very important to me so please bare with me.

My project is a flash presentation (using a projector). For my photo gallery section I will have a container where I need to add the pixellation swf. I tried:

Code:
var imgGallerySwf:MovieClip;
var imgGalleryLoader:Loader = new Loader();
imgGalleryLoader.contentLoaderInfo.addEventListener(Event.INIT, doneLoadingGallery);
imgGalleryLoader.load(new URLRequest("ImageGallery.swf"));    

function doneLoadingGallery($evt:Event):void 
{
    imgGallerySwf = MovieClip(imgGalleryLoader.content);
    this.addChild(imgGallerySwf);
    imgGallerySwf.stop();
}
and what I getting is:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Pixellation/::init()
at Pixellation$iinit()

I made a research and seems that the function init() at Pixellation.as is calling something that is not yet on the stage. This might have something with the LoadingXML class (or the xml file) when called from the main swf but I couldn't realise how to make it be loaded. I'm on AS3 for just 2 weeks, even though I learn pretty fast. Can you help me to find what I'm missing? It would be of great help.

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)  
Old 10-01-08, 08:14
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,489
Rep Power: 6
Flep is on a distinguished road
Re: Load Pixellation Image Gallery into a swf

Hi Equylybra and welcome

First of all you should use Event.ADDED_TO_STAGE that calls the init(event:Event) function.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3 (permalink)  
Old 10-01-08, 14:59
Junior Member
 
Join Date: Jan 2008
Posts: 5
Rep Power: 0
Equylybra is on a distinguished road
Re: Load Pixellation Image Gallery into a swf

Hi Flep,

Thanks. I'll give a try and let you know about my progress.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #4 (permalink)  
Old 10-01-08, 17:09
Junior Member
 
Join Date: Jan 2008
Posts: 5
Rep Power: 0
Equylybra is on a distinguished road
Re: Load Pixellation Image Gallery into a swf

Great Flep!

I also checked your tutorial about the Event.ADDED_TO_STAGE and everything running smothly. Thanks a lot. You'll be in this project credits.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #5 (permalink)  
Old 11-01-08, 15:58
Junior Member
 
Join Date: Jan 2008
Posts: 5
Rep Power: 0
Equylybra is on a distinguished road
Re: Load Pixellation Image Gallery into a swf

Hello Flep,

I'm needing your help once more. I'm trying to add a multiple galleries functionality to your pixellation gallery but I got lost . After some tries, I saw this thread: "Multiple Gallery XML Slideshow" and based on it I changed the LoadingXML.as into:
Code:
package
{
    import flash.display.MovieClip;
    import flash.display.Loader;
    import flash.events.Event;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    import flash.xml.*;
    import flash.geom.ColorTransform;
    
    public class LoadingXML extends MovieClip
    {
        private var my_array:Array;
        
        public function LoadingXML()
        {
            my_array=new Array();
            
            this.loadXML();
        }
        private function loadXML():void
        {
            var loader:URLLoader=new URLLoader();
            loader.addEventListener(Event.COMPLETE,completeHandler);
            
            var request:URLRequest=new URLRequest('gallery.xml');
            try 
            {
                loader.load(request);
            } 
            catch(error:Error) 
            {
                trace('Impossibile caricare il documento.');
            }
        }
        
        private function completeHandler(event:Event):void
        {
            var loader:URLLoader=URLLoader(event.target);
            var result:XML=new XML(loader.data);
            var myXML:XMLDocument=new XMLDocument();
            myXML.ignoreWhite=true;
            myXML.parseXML(result.toXMLString());
            var node:XMLNode=myXML.firstChild;
            
            //var n:int=int(node.firstChild.childNodes.length);
            var n:int=node.childNodes.length;
            var galleryNames_array:Array=new Array;
            
            for(var i:int=0;i<n;i++)
            {
                galleryNames_array.push(node.childNodes[i].attributes['name']);
                var pics_array:Array=new Array();
                var s:int=node.childNodes[i].childNodes.length;
                for(var j:int=0;j<s;j++)
                {
                    Pixellation.url_array.push(node.childNodes[i].childNodes[j].firstChild.attributes['url']);
                    Pixellation.descrizioni_array.push(node.childNodes[i].childNodes[j].firstChild.attributes['descrizione']);
                    
                }
                imgGallery_array.push(Pixellation.url_array);
            }
            imgGallery_array.push(galleryNames_array);
            
            // first index container[] = categories name and second index conteiner[] = picture of the category you called with the first index
            // so for example, the next line will get the ' people ' category ( index 3 of my_array ) and the 3rd picture ( pic_2.jpg ) ----- you can easy browse your array 
            trace(my_array[3][2]);
            
            var nn:int=int(node.firstChild.nextSibling.childNodes.length);
            for(var k:int=0;k<nn;k++)
            {
                if(k==0)
                    mia_root.speed=int(node.firstChild.nextSibling.childNodes[k].firstChild.nodeValue);
                if(k==1)
                {
                    var quadratini:int=int(node.firstChild.nextSibling.childNodes[k].firstChild.nodeValue);
                    mia_root.numW=10;
                    mia_root.numH=quadratini/mia_root.numW;
                }
                if(k==2)
                {
                    mia_root.colore_sfondo=Number(node.firstChild.nextSibling.childNodes[k].firstChild.nodeValue);
                    var newColor:ColorTransform=new ColorTransform();
                    newColor.color=mia_root.colore_sfondo;
                    mia_root.bg_mc.transform.colorTransform=newColor;
                }
                if(k==3)
                    mia_root.des=node.firstChild.nextSibling.childNodes[k].firstChild.nodeValue;
            }
            mia_root.caricaImmagine();
        }
        }
    }
}
And the XML file:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<root>
    <gallery name="Category 1" folder="category1">
        <img url="cat01_img01.jpg" descrizione="descrizione 1"></img>
        <img url="cat01_img02.jpg" descrizione="descrizione 2"></img>
        <img url="cat01_img03.jpg" descrizione="descrizione 3"></img>
        <img url="cat01_img04.jpg" descrizione="descrizione 4"></img>
        <img url="cat01_img05.jpg" descrizione="descrizione 5"></img>
        <img url="cat01_img06.jpg" descrizione="descrizione 6"></img>
    </gallery>
    <gallery name="Category 2" folder="category2">
        <img url="cat02_img01.jpg" descrizione="descrizione 1"></img>
        <img url="cat02_img02.jpg" descrizione="descrizione 2"></img>
        <img url="cat02_img03.jpg" descrizione="descrizione 3"></img>
        <img url="cat02_img04.jpg" descrizione="descrizione 4"></img>
        <img url="cat02_img05.jpg" descrizione="descrizione 5"></img>
        <img url="cat02_img06.jpg" descrizione="descrizione 6"></img>
    </gallery>
    <gallery name="Category 3" folder="category3">
        <img url="cat03_img01.jpg" descrizione="descrizione 1"></img>
        <img url="cat03_img02.jpg" descrizione="descrizione 2"></img>
        <img url="cat03_img03.jpg" descrizione="descrizione 3"></img>
        <img url="cat03_img04.jpg" descrizione="descrizione 4"></img>
        <img url="cat03_img05.jpg" descrizione="descrizione 5"></img>
        <img url="cat03_img06.jpg" descrizione="descrizione 6"></img>
    </gallery>

    <opzioni>
        <velocita_timer>16</velocita_timer>
        <numero_quadratini>100</numero_quadratini>
        <colore_sfondo>0xFFFFFF</colore_sfondo>
        <descrizione>si</descrizione>
    </opzioni>
</root>
Is this correct? And what further changes should be done on Pixellation.as in order to be able to sort my gallery in categories and choose a category via buttons on the main movie (the one which loads the Pixellation.swf)? Hope you can help me again.

Thanks a lot!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Flash Multi Gallery
  #6 (permalink)  
Old 12-01-08, 07:49
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,489
Rep Power: 6
Flep is on a distinguished road
Re: Load Pixellation Image Gallery into a swf

Hi,
I think the best way is to create differents Pixellation galleries and open the correct one by using PHP logics...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #7 (permalink)  
Old 12-01-08, 16:40
Junior Member
 
Join Date: Jan 2008
Posts: 5
Rep Power: 0
Equylybra is on a distinguished road
Re: Load Pixellation Image Gallery into a swf

Hi Flep,

I think PHP doesn't apply to my case because the project will run offline (flash projector). I'll use one only gallery this time. In the future, if I manage to edit your pixellation gallery to support multiple galleries I'll post the source files here.

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #8 (permalink)  
Old 06-08-08, 00:34
Junior Member
 
Join Date: Aug 2008
Posts: 7
Rep Power: 0
smoking is on a distinguished road
Load Pixellation Image Gallery into a swf

Hi everybody, i have got the same problem to insert the swf and i don't know how to do...i'have try a lot of thing but i am quite a beginner in as3 (and in as 2 too ;-) )

!!!! So i understand that i have got to use :

Event.ADDED_TO_STAGE...

i have read the tutorial...but i think it's a bit hard for me and i don't undersattn everything

is it possible to use Event.ADDED_TO_STAGE in the fla and not in the as.script ?

I have try to do this (and o lot of other things...4 hours i try !!) : ...

var imgGallerySwf:MovieClip;
var imgGalleryLoader:Loader = new Loader();
imgGalleryLoader.contentLoaderInfo.addEventListene r(Event.INIT,doneLoadingGallery);
imgGalleryLoader.load(new URLRequest("main.swf"));

function doneLoadingGallery($evt:Event):void {

imgGallerySwf = MovieClip(imgGalleryLoader.content);
imgGallerySwf.addEventListener( Event.ADDED_TO_STAGE, doneLoadingGallery2 );
function doneLoadingGallery2($evt:Event):void {
this.addChild(imgGallerySwf);
imgGallerySwf.stop();}

}

...but still doesn't work of course !
So is there someone witch could explain me how to do exactly ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #9 (permalink)  
Old 06-08-08, 03:21
Junior Member
 
Join Date: Aug 2008
Posts: 7
Rep Power: 0
smoking is on a distinguished road
Re: Load Pixellation Image Gallery into a swf

I am still working on it ;-)...

still not find !!

I have try to include :addEventListener(Event.ADDED_TO_STAGE,init);

in the main.fla...on the first keyframe or like this :

bg_mc.addEventListener(Event.ADDED_TO_STAGE,init );
still not work

i have try in the package pixellation ...a bit every where...
but still not !

...I have read the cs3 forum...sometimes some problems like this one..but no a clear solution for me...

so if someone ihave got the answer it 'll be great !!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #10 (permalink)  
Old 06-08-08, 03:45
Junior Member
 
Join Date: Aug 2008
Posts: 7
Rep Power: 0
smoking is on a distinguished road
Re: Load Pixellation Image Gallery into a swf

waouuu !! begin to find a solution : i post it for everyone ;-) !!!

in the pixellation.as change this :

etc............

public function Pixellation()

{ addEventListener(Event.ADDED_TO_STAGE, init);

}

private function init(evt:Event):void
{
stage.frameRate=31;
tastiera_mc.pausa_mc.stop();
tastiera_mc.x=des_mc.x=this.parent.stage.stageWidt h/2;


.....etc
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Actionscript 3 Help to "rewind" image gallery metalblade183 Actionscript 3.0 newbies 0 01-10-08 04:50
Blurring Gallery - Image Positions Indyp HELP free utilities 0 23-06-08 02:43
Pixellation Gallery - Image Sizes problem Indyp HELP free utilities 0 20-06-08 17:25
Pixellation lievito AIUTO utilità free 1 24-12-07 08:03
Pixellation Slide Show Gallery not loading ryan_star HELP free utilities 9 19-11-07 12:46


All times are GMT. The time now is 18:45.


Powered by vBulletin versione 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap


FlepStudio
by Filippo Lughi
P.IVA 03605860406