Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Actionscript / June 2006



Tip: Looking for answers? Try searching our database.

events in classes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jim Esteban - 28 Jun 2006 21:58 GMT
I'm working on a projector class for displaying images as a slide show.  I've
been getting errors like as follows:

**Error** D:\jjesteban.com\src\flash\SlideScroller\Projector.as: Line 98: This
statement is not permitted in a class definition.
         Projector_mcListener.onLoadComplete=function()

Is it not possible to code events in a class definition.
LuigiL - 28 Jun 2006 22:55 GMT
Maybe show just a few more lines of code... this is not enough info to give a meaningful answer.
myIP - 29 Jun 2006 02:19 GMT
That line of code is probably not inside the class method from the type of
error you are receiving.

private function myEvent()
{
this.onLoadComplete = function()
{
}
}

But that does not necessary means your problem is fixed.  Yeah we need more
code.
Jim Esteban - 29 Jun 2006 21:13 GMT
I got passed the intial errors by putting all of the events inside of the
constructor.  I've linked an empty movie clip to this class and when I run the
program the onEnterFrame seems to work okay until I run initialize in the main
time.  The first slide loads okay but then it doesn't seem to get the
onenterframe event anymore.
Here's the entire class.

//main timeline code
// variable declarations
var startingY:Number=display_mc.list_mc._y;
var bottom:Number=120;
var direction:String;
var scrollButtonPressed:Boolean=false;
var sitePath:String = "http://www.jjesteban.com";
var SlideDataIndex:Number;
//data variables
var columns:Array;
var dt:Array;
var dat:Array;
var
submitURL:String="http://www.jjesteban.com/flash/ScrollingList/getdata.cfm";
var submitQRY:String="select * from tbl_slideshow order by albumindex";
var datasource:String="jesteban";
var delim1:String="~";
var delim2:String="~~";
var dataReady:Boolean=false;
var firstTime:Boolean=true;
//LoadVars
var i_sql_lv:LoadVars=new LoadVars();
var o_sql_lv:LoadVars=new LoadVars();
//functions
function SandL()
{
    o_sql_lv.qry=submitQRY;
    o_sql_lv.ds=datasource;
    o_sql_lv.delim1=delim1;
    o_sql_lv.delim2=delim2;
    i_sql_lv.reply_qry="";            //SQL Text
    i_sql_lv.reply_ds="";             //datasource
    i_sql_lv.reply_c="";                 //column headings
    i_sql_lv.reply_d="";                 //data
    o_sql_lv.sendAndLoad(submitURL,i_sql_lv,"POST");
}
function buildList()
{
    var spacing:Number=30;
    for(var i:Number=0;i<dt.length;i++)
    {
        var name:String = "infoBar" + String(i) + "_mc";
        var y:Number = i * spacing;
        display_mc.list_mc.attachMovie("infoBar",name,i);
        display_mc.list_mc[name]._y=y;
        display_mc.list_mc[name].title_txt.text = dat[i][2];
        display_mc.list_mc[name].num_txt.text = dat[i][0];
        display_mc.list_mc[name].datidx=i;
        display_mc.list_mc[name].onRelease=function()
        {
            SlideDataIndex=this.datidx;
            counter=0;
            display_mc.title_txt.text=dat[SlideDataIndex][2];
            display_mc.total_txt.text=dat[SlideDataIndex][6];
            display_mc.slidestart_btn.enabled=false;
            display_mc.slidestart_btn._visible=false;
            display_mc.slidestop_btn.enabled=true;
            display_mc.slidestop_btn._visible=true;
            display_mc.slideinc_btn.enabled=false;
            display_mc.slideinc_btn._visible=false;
            display_mc.slidedec_btn.enabled=false;
            display_mc.slidedec_btn._visible=false;
            projector1_mc.PreloaderBlinkerDisplay_mc=blinker_mc;
            projector1_mc.ProjectorLoadProgressDisplay_mc=slideload_mc;
            projector1_mc.ProjectorPlayProgressDisplay_mc=display_mc.progress_mc;

            projector1_mc.Initialize(200,Number(dat[SlideDataIndex][3]),Number(dat[SlideD
ataIndex][6]),true,sitePath+dat[SlideDataIndex][1],dat[SlideDataIndex][5],dat[Sl
ideDataIndex][4]);
        }
    }
}
function scroll()
{
    var speed:Number=10;
    if(direction=="up")
    {
        if(display_mc.list_mc._y - speed + display_mc.list_mc._height > (startingY +
bottom))
        {
            display_mc.list_mc._y -= speed;
        }
        else
        {
            display_mc.list_mc._y = (startingY + bottom) - display_mc.list_mc._height;
        }
    }
    else if(direction=="down")
    {
        if(display_mc.list_mc._y + speed < startingY)
        {
            display_mc.list_mc._y += speed;
        }
        else
        {
            display_mc.list_mc._y = startingY;
        }
    }
}
//events
i_sql_lv.onLoad=function(success)
{
    if(success)
    {
        // Column Names
        columns = new Array();
        columns = i_sql_lv.reply_c.split(delim1);
        // Column Data
        dt = new Array();
        dt = i_sql_lv.reply_d.split(delim2);
        dat = new Array(dt.length);
        for( var i:Number=0; i < dt.length;i++)
        {
            dat[i] = new Array();
            dat[i] = dt[i].split(delim1);
        }
        dataReady=true;
    }
    else
    {
        dataReady=false;
    }
}
display_mc.down_btn.onPress=function()
{
    scrollButtonPressed=true;
    direction="down";
}
display_mc.down_btn.onRelease=function()
{
    scrollButtonPressed=false;
}
display_mc.up_btn.onPress=function()
{
    scrollButtonPressed=true;
    direction="up";
}
display_mc.up_btn.onRelease=function()
{
    scrollButtonPressed=false;
}
display_mc.slidestop_btn.onRelease=function()
{
    //goShow=false;
    //counter=counterMax;
    //fade=false;
    display_mc.slidestop_btn.enabled=false;
    display_mc.slidestop_btn._visible=false;
    display_mc.slidestart_btn.enabled=true;
    display_mc.slidestart_btn._visible=true;
    display_mc.slideinc_btn.enabled=true;
    display_mc.slideinc_btn._visible=true;
    display_mc.slidedec_btn.enabled=true;
    display_mc.slidedec_btn._visible=true;
}
display_mc.slidestart_btn.onRelease=function()
{
    //goShow=true;
    //fade=true;
    display_mc.slidestart_btn.enabled=false;
    display_mc.slidestart_btn._visible=false;
    display_mc.slidestop_btn.enabled=true;
    display_mc.slidestop_btn._visible=true;
    display_mc.slideinc_btn.enabled=false;
    display_mc.slideinc_btn._visible=false;
    display_mc.slidedec_btn.enabled=false;
    display_mc.slidedec_btn._visible=false;
}
display_mc.slideinc_btn.onRelease=function()
{
    //changeSlide(currentSlide+1);
    //counter=counterMax;
}
display_mc.slidedec_btn.onRelease=function()
{
    //changeSlide(currentSlide-1);
    //counter=counterMax;
}
//Setup
blinker_mc.gotoAndStop("loaded");
display_mc.slidestart_btn.enabled=false;
display_mc.slidestart_btn._visible=false;
display_mc.slidestop_btn.enabled=false;
display_mc.slidestop_btn._visible=false;
display_mc.slideinc_btn.enabled=false;
display_mc.slideinc_btn._visible=false;
display_mc.slidedec_btn.enabled=false;
display_mc.slidedec_btn._visible=false;
display_mc.progress_mc._visible=false;
slideload_mc._visible=false;
slideload_txt._visible=false;
SandL();
//Program Start
_root.onEnterFrame=function()
{
    if(firstTime and dataReady)
    {
        buildList();
        firstTime=false;
    }
    if(!firstTime and dataReady)
    {
        if(scrollButtonPressed)
        {
            scroll();
        }
    }
}
//class in as file
class Projector extends MovieClip
{
    //public variable declarations
    public var PreloaderBlinkerDisplay_mc:MovieClip;
    public var PreloaderBlinkerDisplayLoadingFrame:String="loading";
    public var PreloaderBlinkerDisplayLoadedFrame:String="loaded";
    public var ProjectorLoadProgressDisplay_mc:MovieClip;
    public var ProjectorPlayProgressDisplay_mc:MovieClip;
    //private variable declarations
    private var __goShow:Boolean;
    private var fade:Boolean;
    private var projectorWidth:Number;
    private var imagePath:String;
    private var imageFile:String;
    private var imageExt:String;
    private var firstSlide:Number;
    private var lastSlide:Number;
    private var currentSlide:Number;
    private var counterMax:Number;
    private var counter:Number;
    private var count:Boolean;
    private var fadeoutRange:Number;
    private var fadeinRange:Number;
    private var SlideLoaded:Boolean;
    private var PreLoaded:Boolean;
    private var Preloader_mc:MovieClip;
    //loaders and listeners
    private var Projector_mcLoader:MovieClipLoader;
    private var Projector_mcListener:Object;
    private var Preloader_mcLoader:MovieClipLoader;
    private var Preloader_mcListener:Object;
    //constructor
    function Projector()
    {
        var thisObj:Projector = this;
        trace("In Projector");
        Projector_mcLoader=new MovieClipLoader();
        Projector_mcListener=new Object();
        Preloader_mcLoader=new MovieClipLoader();
        Preloader_mcListener=new Object();
        Projector_mcLoader.addListener(Projector_mcListener);
        Preloader_mcLoader.addListener(Preloader_mcListener);

        Preloader_mc=_root.createEmptyMovieClip("Preloader_mc",_root.getNextHighestDep
th());
        Preloader_mc._x=100;
        Preloader_mc._y=100;
        this.__goShow=false;
        this.fade=true;
        this.projectorWidth=0;
        this.imagePath="";
        this.imageFile="";
        this.imageExt="";
        this.firstSlide=1;
        this.lastSlide=1;
        this.currentSlide=1;
        this.counterMax=150;
        this.counter=150;
        this.count=false;
        this.fadeoutRange=30;
        this.fadeinRange=30;
        this.SlideLoaded=false;
        this.PreLoaded=false;
        Projector_mcListener.onLoadStart=function(target_mc:MovieClip)
        {
            var g:String=thisObj.__goShow?"true":"false";
            var s:String=thisObj.SlideLoaded?"true":"false";
            var c:String=thisObj.count?"true":"false";
            trace("__goShow=" + g + ", SlideLoaded=" + s + ", count=" + c + " counter="
+ String(c));
            trace("Projector_mcListener.onLoadStart");
            thisObj.SlideLoaded=false;   
            if(thisObj.ProjectorLoadProgressDisplay_mc != undefined)
            {
                thisObj.ProjectorLoadProgressDisplay_mc._visible=true;
                thisObj.ProjectorLoadProgressDisplay_mc.gotoAndPlay(0);
            }
        }
        Projector_mcListener.onLoadProgress=function(target_mc:MovieClip,
bytesLoaded:Number, bytesTotal:Number)
        {
            var g:String=thisObj.__goShow?"true":"false";
            var s:String=thisObj.SlideLoaded?"true":"false";
            var c:String=thisObj.count?"true":"false";
            trace("__goShow=" + g + ", SlideLoaded=" + s + ", count=" + c + " counter="
+ String(c));
            trace("Projector_mcListener.onLoadProgress");
            if(thisObj.ProjectorLoadProgressDisplay_mc != undefined)
            {

                thisObj.ProjectorLoadProgressDisplay_mc.gotoAndPlay(Math.round((bytesLoaded/
bytesTotal)*100));
            }
        }
        Projector_mcListener.onLoadComplete=function(target_mc:MovieClip)
        {
            var g:String=thisObj.__goShow?"true":"false";
            var s:String=thisObj.SlideLoaded?"true":"false";
            var c:String=thisObj.count?"true":"false";
            trace("__goShow=" + g + ", SlideLoaded=" + s + ", count=" + c + " counter="
+ String(c));
            trace("Projector_mcListener.onLoadComplete");
            thisObj.SlideLoaded=true;
            if(thisObj.ProjectorLoadProgressDisplay_mc != undefined)
            {
                thisObj.ProjectorLoadProgressDisplay_mc._visible=false;
            }
            //preloadSlide(currentSlide+1);
        }
        Preloader_mcListener.onLoadComplete=function(target_mc:MovieClip)
        {
            thisObj.PreLoaded=true;   
            if(thisObj.PreloaderBlinkerDisplay_mc != undefined)
            {
                thisObj.PreloaderBlinkerDisplay_mc.gotoAndStop("loaded");
            }
            thisObj.Preloader_mc._visible=false;
        }
        Projector_mcListene
myIP - 30 Jun 2006 03:03 GMT
I haven?t fully looked at your code except the onEnterFrame handler that is in
your class.  You have;

this.onEnterFrame=function()

The key word ?this? is referring to the class not necessary the timeline
unless you have the linkage for this MovieClip to receive myClass.  This can be
done by right-clicking on the symbol tab to ?Linkage? and the field that says
?AS 2.0 class? in the popup is where the name of the class would go.  Also if
you are creating an instance of this class on the _root the onEnterFrame will
not work as you have it.  You need to target the timeline.  So I always target
the timeline in my constructor as below;

//in the FLA
mC = new myClass(this);

//in the AS- myClass.as
class myClass extends MovieClip
{
    private var target_mc:MovieClip;
   
    public function myClass(t)
    {
        this.target_mc = t;
       
        this.target_mc.onEnterFrame = function()
        {
            trace("hitting the frame");
        }       
    }
}
Jim Esteban - 30 Jun 2006 19:06 GMT
I've had the AS 2.0 Linkage set to the class name "Projector" from the
beginning.
//in the FLA
mC = new myClass(this);

This instance name of the MovieClip which is linked to the Projector class in
Projector1_mc.  Should the above line of code go there or in the root.

//in the AS- myClass.as
class myClass extends MovieClip
{
    private var target_mc:MovieClip;
   
    public function myClass(t)
    {
Where does t come from?
        this.target_mc = t;
       
        this.target_mc.onEnterFrame = function()
        {
            trace("hitting the frame");
        }       
    }
}

Thanks for your help.  I have given up a couple of times out of frustration,
but I keep on coming back to it.  This morning I was reading the documentation
and It say's:
You can define the function on the timeline or in a class file that extends
the MovieClip class
So I should be able to do this.
myIP - 30 Jun 2006 21:00 GMT
If you have the Linkage set up to the class you created then there is no need
to create a new instance of that class using the following code;

mC = new myClass(this);

If that movieclip that has your Projector class wired to it thru the linkage
is on stage you should be ok.  Is it?  Or is it dynamically attached to the
stage?  If not you can attach it to the stage, attachMovie().

?Where did you t come from?

If you don?t have the class wired to the symbol via Linkage then we would have
to go about this task by creating an instance?

mC = new myClass(this);

This creates an instance of your class that passes the only parameter to the
constructor function (the function that has the same name of the class).  This
function is automatically invoked and must be public when an instance is
created, which we named, ?mC?.  ?this? is referring to the timeline, which is a
MovieClip datatype.  ?this.target_mc? that is in the class inherits the scope
from the timeline thru ?t?.  We then use ?this.target_mc? to reference the
timeline.  Does that help?  I hope I am not pointing out the obvious to you.  
Jim Esteban - 30 Jun 2006 21:32 GMT
I simplified some of the code and I attached the output screen.  I'm using the
onEnterFrame of projector1_mc you can see it running in the output then I push
a button on the scroller and it goes through Intialize and in a short time it
loads the image and after that the projector1_mc onEnterFrame stops running.  
Don't know why.

You can see the current state of the program running at:
 http://www.jjesteban.com/template.cfm?s1=5&s2=1&ContentID=279

//code in frame 1 the only frame of  the root
// variable declarations
var startingY:Number=display_mc.list_mc._y;
var bottom:Number=120;
var direction:String;
var scrollButtonPressed:Boolean=false;
var sitePath:String = "http://www.jjesteban.com";
var SlideDataIndex:Number;
//data variables
var columns:Array;
var dt:Array;
var dat:Array;
var
submitURL:String="http://www.jjesteban.com/flash/ScrollingList/getdata.cfm";
var submitQRY:String="select * from tbl_slideshow order by albumindex";
var datasource:String="jesteban";
var delim1:String="~";
var delim2:String="~~";
var dataReady:Boolean=false;
var firstTime:Boolean=true;
//LoadVars
var i_sql_lv:LoadVars=new LoadVars();
var o_sql_lv:LoadVars=new LoadVars();
//functions
//this goes and gets data from the database
function SandL()
{
    o_sql_lv.qry=submitQRY;
    o_sql_lv.ds=datasource;
    o_sql_lv.delim1=delim1;
    o_sql_lv.delim2=delim2;
    i_sql_lv.reply_qry="";            //SQL Text
    i_sql_lv.reply_ds="";             //datasource
    i_sql_lv.reply_c="";                 //column headings
    i_sql_lv.reply_d="";                 //data
    o_sql_lv.sendAndLoad(submitURL,i_sql_lv,"POST");
}
//this builds the scroller
function buildList()
{
    var spacing:Number=30;
    for(var i:Number=0;i<dt.length;i++)
    {
        var name:String = "infoBar" + String(i) + "_mc";
        var y:Number = i * spacing;
        display_mc.list_mc.attachMovie("infoBar",name,i);
        display_mc.list_mc[name]._y=y;
        display_mc.list_mc[name].title_txt.text = dat[i][2];
        display_mc.list_mc[name].num_txt.text = dat[i][0];
        display_mc.list_mc[name].datidx=i;
        display_mc.list_mc[name].onRelease=function()
        {
            SlideDataIndex=this.datidx;
            counter=0;
            display_mc.title_txt.text=dat[SlideDataIndex][2];
            display_mc.total_txt.text=dat[SlideDataIndex][6];
            display_mc.slidestart_btn.enabled=false;
            display_mc.slidestart_btn._visible=false;
            display_mc.slidestop_btn.enabled=true;
            display_mc.slidestop_btn._visible=true;
            display_mc.slideinc_btn.enabled=false;
            display_mc.slideinc_btn._visible=false;
            display_mc.slidedec_btn.enabled=false;
            display_mc.slidedec_btn._visible=false;

            projector1_mc.Initialize(200,Number(dat[SlideDataIndex][3]),Number(dat[SlideD
ataIndex][6]),true,sitePath+dat[SlideDataIndex][1],dat[SlideDataIndex][5],dat[Sl
ideDataIndex][4]);
        }
    }
}
function scroll()
{
    var speed:Number=10;
    if(direction=="up")
    {
        if(display_mc.list_mc._y - speed + display_mc.list_mc._height > (startingY +
bottom))
        {
            display_mc.list_mc._y -= speed;
        }
        else
        {
            display_mc.list_mc._y = (startingY + bottom) - display_mc.list_mc._height;
        }
    }
    else if(direction=="down")
    {
        if(display_mc.list_mc._y + speed < startingY)
        {
            display_mc.list_mc._y += speed;
        }
        else
        {
            display_mc.list_mc._y = startingY;
        }
    }
}
//events
i_sql_lv.onLoad=function(success)
{
    if(success)
    {
        // Column Names
        columns = new Array();
        columns = i_sql_lv.reply_c.split(delim1);
        // Column Data
        dt = new Array();
        dt = i_sql_lv.reply_d.split(delim2);
        dat = new Array(dt.length);
        for( var i:Number=0; i < dt.length;i++)
        {
            dat[i] = new Array();
            dat[i] = dt[i].split(delim1);
        }
        dataReady=true;
    }
    else
    {
        dataReady=false;
    }
}
display_mc.down_btn.onPress=function()
{
    scrollButtonPressed=true;
    direction="down";
}
display_mc.down_btn.onRelease=function()
{
    scrollButtonPressed=false;
}
display_mc.up_btn.onPress=function()
{
    scrollButtonPressed=true;
    direction="up";
}
display_mc.up_btn.onRelease=function()
{
    scrollButtonPressed=false;
}
display_mc.slidestop_btn.onRelease=function()
{
    //goShow=false;
    //counter=counterMax;
    //fade=false;
    display_mc.slidestop_btn.enabled=false;
    display_mc.slidestop_btn._visible=false;
    display_mc.slidestart_btn.enabled=true;
    display_mc.slidestart_btn._visible=true;
    display_mc.slideinc_btn.enabled=true;
    display_mc.slideinc_btn._visible=true;
    display_mc.slidedec_btn.enabled=true;
    display_mc.slidedec_btn._visible=true;
}
display_mc.slidestart_btn.onRelease=function()
{
    //goShow=true;
    //fade=true;
    display_mc.slidestart_btn.enabled=false;
    display_mc.slidestart_btn._visible=false;
    display_mc.slidestop_btn.enabled=true;
    display_mc.slidestop_btn._visible=true;
    display_mc.slideinc_btn.enabled=false;
    display_mc.slideinc_btn._visible=false;
    display_mc.slidedec_btn.enabled=false;
    display_mc.slidedec_btn._visible=false;
}
display_mc.slideinc_btn.onRelease=function()
{
    //changeSlide(currentSlide+1);
    //counter=counterMax;
}
display_mc.slidedec_btn.onRelease=function()
{
    //changeSlide(currentSlide-1);
    //counter=counterMax;
}
//Setup
blinker_mc.gotoAndStop("loaded");
display_mc.slidestart_btn.enabled=false;
display_mc.slidestart_btn._visible=false;
display_mc.slidestop_btn.enabled=false;
display_mc.slidestop_btn._visible=false;
display_mc.slideinc_btn.enabled=false;
display_mc.slideinc_btn._visible=false;
display_mc.slidedec_btn.enabled=false;
display_mc.slidedec_btn._visible=false;
display_mc.progress_mc._visible=false;
slideload_mc._visible=false;
slideload_txt._visible=false;
SandL();
//Program Start
_root.onEnterFrame=function()
{
    if(firstTime and dataReady)
    {
        buildList();
        firstTime=false;
    }
    if(!firstTime and dataReady)
    {
        if(scrollButtonPressed)
        {
            scroll();
        }
        trace("root");
    }
}

// code is frame 1 the onl frame of projector1_mc This is the frame that the
image is displayed in and it is attached to the  Projector class via linkage
//Projector.as
class Projector extends MovieClip
{
    //private variable declarations
    private var fade:Boolean=true;
    private var projectorWidth:Number=100;
    private var imagePath:String="";
    private var imageFile:String="";
    private var imageExt:String=".jpg";
    private var firstImage:Number=1;
    private var lastImage:Number=1;
    private var currentImage:Number=1;
    private var counterMax:Number=150;
    private var counter:Number=0;
    private var count:Boolean=false;
    private var fadeoutRange:Number=30;
    private var fadeinRange:Number=30;
    //loaders and listeners
    private var Projector_mclLoader:MovieClipLoader;
    private var Projector_mclListener:Object;
    //constructor
    function Projector()
    {
        trace("In Projector");
        Projector_mclLoader=new MovieClipLoader;
        Projector_mclListener=new Object();
        Projector_mclLoader.addListener(Projector_mclListener);
        var thisObj:Projector = this;
        Projector_mclListener.onLoadInit=function(target_mc:MovieClip)
        {   
            var w:Number = target_mc._width * 100 / target_mc._xscale;
            var h:Number = target_mc._height * 100 / target_mc._yscale;
            target_mc._xscale=Math.round(20000/target_mc._width);
            target_mc._yscale=target_mc._xscale;
            target_mc.lineStyle(4*100/target_mc._xscale,0x000000,100);
            target_mc.lineTo(0,h);
            target_mc.lineTo(w,h);
            target_mc.lineTo(w,0);
            target_mc.lineTo(0,0);
            target_mc._alpha=fade?0:100;
            target_mc._count=true;
            var c:String=target_mc._count?"true":"false";
            target_mc._counter=0;
            var n:Number=target_mc._counter;
            trace("count=" + c + " counter=" + String(n) + " Image Number = " +
String(target_mc.currentImage));
            trace("Projector_mclListener.onLoadInit");
        }

        Projector_mclListener.onLoadError=function(target_mc:MovieClip,errorcode:Strin
g)
        {
            trace("onLoadError errorcode= " + errorcode);
        }
    }
    public function
Initialize(w:Number,fir:Number,las:Number,fad:Boolean,path:String,file:String,ex
t:String)
    {
        trace("Initialized");
        this.firstImage=fir;
        this.lastImage=las;
        this.currentImage=this.firstImage-1;
        this.fade=fad;
        this.imagePath=path;
        this.imageFile=file;
        this.imageExt=ext;
        this.projectorWidth=w;
        this.counter=140;
        this.counterMax=150;
        this._count=true;
    }
    private function changeImage(number:Number)
    {
        if(number < firstImage)
        {
            number = lastImage;
        }
        if(number > lastImage)
        {
            number = firstImage;
        }
        if(number >= firstImage & number <= lastImage)
        {
            currentImage = number;
            this._yscale=100;
            this._xscale=100;
            this.count=false;
            this.counter=0;
            Projector_mclLoader.loadClip(imagePath + imageFile + String(number) +
imageExt,this._name);
        }
    }
    private function Alpha(fiRange:Number, foRange:Number):Number
    {
        var alpha:Number=100;
        var foThreshold:Number=counterMax-foRange;
        var fiThreshold:Number=fiRange;
        var fadeThreshold:Number=(fiRange+foRange)*0;
        if(counterMax >= fadeThreshold and fade==true)
        {
            if((counterMax-counter)<=foRange )
            {
                alpha=100-(((counter-foThreshold)/foRange)*100);
            }
            if(counter<=fiThreshold)
            {
                alpha=100-(((fiThreshold-counter)/fiRange)*100);
            }
        }
        return(alpha);
    }
    public function run()
    {
        var c:String=this._count?"true":"false";
        trace("_count=" + c + "_counter=" + String(this._counter));
        if(this._count)
        {
            //this._alpha=Alpha(this.fadeinRange,this.fadeoutRange);
            if(++this._counter>=this._counterMax)
            {
                this.changeImage(this.currentImage+1);
            }
        }
    }       
    public function set _count(n:Boolean)
    {
        count=n;
    }
    public function get _count():Boolean
    {
        return count;
    }
    public function set _counter(n:Number)
    {
        counter=n;
    }
    public function get _counter():Number
    {
        return counter;
    }
    public function get _counterMax():Number
    {
        return counterMax;
    }
}

//output screen

D:\jjesteban.com\src\flash\SlideScroller\scrollingList
LuigiL - 30 Jun 2006 10:53 GMT
That's a few more lines of code... :smile;

>>The first slide loads okay but then it doesn't seem to get the onenterframe
event anymore.
Resulting in what problem? Scroller won't work? Next slides won't load? Won't
autoplay? Please try to elaborate on the exact problem so we don't have to read
the whole (uncommented) code.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.