Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

Modifying external swf site of Flep

This is a discussion on Modifying external swf site of Flep within the Actionscript 3.0 newbies forums, part of the Flash CS3 eng category; Hy Flep, i´m trying to modify your great flash cs3 site! but i´m a bit stuck, so maybe ...


Go Back   Forum Flash CS3 Flash CS4 > English Forums > Flash CS3 eng > Actionscript 3.0 newbies

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 17-05-08, 17:44
Junior Member
 
Join Date: May 2008
Posts: 25
Rep Power: 0
madmad is on a distinguished road
Modifying external swf site of Flep

Hy Flep,

i´m trying to modify your great flash cs3 site! but i´m a bit stuck, so maybe you could help:

Code:
package
{
    import flash.display.MovieClip;
    import flash.display.SimpleButton;
    import flash.display.Loader;
    import flash.net.URLRequest;
    import flash.events.*;
    
    public class Main extends MovieClip
    {
        private var section_array:Array;
        private var button_section_array:Array;
        
        private var loader:Loader;
        
        private var swf:String;
        
        private var id:int=0;
        
        public function Main()
        {
            init();
        }
        
        private function init():void
        {
            stop();
            stage.frameRate=31;
            
            home_btn.visible=false;
            menu_mc.visible=false;
            preloader_mc.visible=false;
            preloader_mc.fill_mc.width=0;
            
            section_array=new Array('./home/home.swf',
            './ouverture/ouverture.swf',
            './klassik/klassik.swf',
            './stoff1/stoff1.swf',
            './stoff2/stoff2.swf',
            './kleider/kleider.swf');
            button_section_array=new Array(menu_mc.sezione_1_mc,menu_mc.sezione_2_mc,
            menu_mc.sezione_3_mc,menu_mc.sezione_4_mc,
            menu_mc.sezione_5_mc);
            
            addListenerEnter();
            addListenerHome();
            addListenerMenu();
        }
        
        private function addListenerEnter():void
        {
            logo_mc.entra_mc.buttonMode=true;
            logo_mc.entra_mc.addEventListener(MouseEvent.MOUSE_DOWN,entra);
        }
        
        private function addListenerHome():void
        {
            home_btn.addEventListener(MouseEvent.MOUSE_DOWN,tornaHome);
        }
        
        private function addListenerMenu():void
        {
            for(var i:int=0;i < button_section_array.length;i++)
            {
                button_section_array[i].id=i;
                button_section_array[i].addEventListener(MouseEvent.MOUSE_DOWN,cambiaSezione);
            }
        }
        
        private function entra(m:MouseEvent):void
        {
            this.gotoAndStop(2);
            caricaHome();
        }
        
        private function tornaHome(m:MouseEvent):void
        {
            id=0;
            loader.unload();
            removeChild(loader);
            rimuoviListeners(loader.contentLoaderInfo);
            caricaHome();
        }
        
        private function caricaHome():void
        {
            swf=section_array[0];
            var request:URLRequest=new URLRequest(swf);
            loader=new Loader();
            initListeners(loader.contentLoaderInfo);
            loader.load(request);
            id=0;
        }
        
        private function cambiaSezione(m:MouseEvent):void
        {
            id=m.target.parent.id+1;
            loader.unload();
            removeChild(loader);
            rimuoviListeners(loader.contentLoaderInfo);
            caricaSezione(m.target.parent.id+1);
        }
        
        private function caricaSezione(n:int):void
        {
            swf=section_array[id];
            var request:URLRequest=new URLRequest(swf);
            loader=new Loader();
            initListeners(loader.contentLoaderInfo);
            loader.load(request);
        }
        
        private function initListeners(dispatcher:IEventDispatcher):void 
        {
            dispatcher.addEventListener(Event.OPEN,inizia);
            dispatcher.addEventListener(ProgressEvent.PROGRESS,inCaricamento);
            dispatcher.addEventListener(Event.COMPLETE,completato);
        }
        
        private function rimuoviListeners(dispatcher:IEventDispatcher):void 
        {
            dispatcher.removeEventListener(Event.OPEN,inizia);
            dispatcher.removeEventListener(ProgressEvent.PROGRESS,inCaricamento);
            dispatcher.removeEventListener(Event.COMPLETE,completato);
        }
        
        private function inizia(event:Event):void 
        {
            menu_mc.visible=false;
            preloader_mc.visible=true;
        }
        private function inCaricamento(event:ProgressEvent):void 
        {
            var n:uint=(event.bytesLoaded/event.bytesTotal)*100;
            preloader_mc.fill_mc.width=n;
        }
        private function completato(event:Event):void 
        {
            addChild(loader);
            swappa();
            preloader_mc.visible=false;
            if(id!=0)
                home_btn.visible=true;
            else
                home_btn.visible=false;
            menu_mc.visible=true;
        }
        
        private function swappa():void
        {
            swapChildren(loader,menu_mc);
            swapChildren(home_btn,loader);
        }
    }
}
Instead of a simple button i want to have my own buttons, with something like "over" "out" and "active" or just gotoAndStop(1) / (2) / (3).

And i want to get rid of the home button thing (i want to integrate in one of these buttons, but of course should be loaded first!

Would be cool to get some respond, b´cause your tutorial is the only one over the net i really think that works!

mucho gracie
Madmad
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
How to create a site loading external SWF with Flash CS3 Flep Tutorials 32 17-11-08 20:02
Flash CS3 Having problem with mailscript for my flash site :( xxsassxx31 Flash CS3 eng 1 28-10-08 13:48
Problem With Sectioned Site And Content With Events In Those Sections donteatyourfriends Actionscript 3.0 newbies 1 02-04-08 07:35
Please help me w/ a few issues w/ my 1st Flash site - lags, transition nav, popups o0ochr1so0o Actionscript 3.0 newbies 10 06-01-08 18:27
me <3 flep Zombie Off Topics 1 06-12-07 13:20


All times are GMT. The time now is 11:03.


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