PDA

View Full Version : Newsreader AS Function() errors - making me ill


HotWings
08-11-2004, 03:23 AM
Hi, I copied this from another site...

but when I TRY and publish i continually get "2 errors" and I have TRIED everything to make it work... are the functions entered incorrectly? I tried adding {}, but nothing helps it run....


I marked *** Line 91 ***** and 107 **** in the AS below (very bottom of code)

thanks, this is driving me CRAZYYYYYYYYYYYY
~HotWings


----------------------------------
DEBUG ERRORS:

**Error** Symbol=Symbol 337, layer=ActionScript, frame=1:Line 91: '{' expected
scrollSlider = function (dir);

**Error** Symbol=Symbol 337, layer=ActionScript, frame=1:Line 107: Syntax error.

Total ActionScript Errors: 2 Reported Errors: 2
----------------------------------



ACTUAL ACTIONSCRIPT:


setLinesVisible = function ()
{
var visibleIndex = 7;
var pos = this.holder._y;
var topClips = int(pos / -15);
var i = _root.lineArr.length;
if (this.holder != NULL)
{
variables = this.holder;
var feed = this.holder[variables];
feed._visible = true;
(true);
feed._visible = false;
!(topClips >= i || int(topClips + visibleIndex) < i) ? false : true;
i--;
} // End of the function
} // end if


setSliderHeight = function ()
{
if (this.holder._height < initHeight)
{
this.slider._height = initHeight;
this.slider._visible = false;
}
else
{
this.slider._height = initHeight * (initHeight / this.holder._height);
this.slider._visible = true;
} // End of the function
} // end if

initHeight = 80;
speed = 5;

function ()
{
var scrollPos = -slider._y + 1;
var ratio = this.initHeight / this.slider._height;
var newPos = scrollPos * ratio;
var difY = newPos - this.holder._y;
this.holder._y = int(this.holder._y + difY / speed);
} // End of the function


easeDrag = function ()
{
setSliderHeight();
var dragSpace = 2 + this.initHeight - this.slider._height;
var ratio = this.initHeight / this.slider._height;
this.slider._y = dragSpace;
this.holder._y = int(2 - this.slider._y * ratio);
} // End of the function


reposSlider = function (dir)
{
var scrollSpace = 2 + initHeight - this.slider._height;
var stepNum = Math.floor(scrollSpace / 8);
var scrollStep = int(scrollSpace / stepNum);
var ratio = initHeight / this.slider._height;
if (dir == -1)
{
swDebug.trace("going down = " + scrollStep);
if (this.slider._y + scrollStep >= scrollSpace)
{
this.slider._y = this.slider._y + scrollStep;
}
else
{
this.slider._y = scrollSpace;
} // end if
}
else
{
swDebug.trace("going up = " + scrollStep);
if (this.slider._y - scrollStep >= 1)
{
this.slider._y = this.slider._y - scrollStep;
}
else
{
this.slider._y = 1;
} // end if
} // end if
this.holder._y = int(2 - this.slider._y * ratio);
} // End of the function

****************LINE 91*************

scrollSlider = function (dir);

slider.onPress = function ()
{
this._parent.dragmode = 1;
var dragSpace = 2 + this._parent.initHeight - this._parent.slider._height;
this.startDrag(false, 203, 1, 203, dragSpace);
} // End of the function

slider.onRelease = function ()
{
this._parent.dragmode = 0;
this.stopDrag();
} // End of the function

****************LINE 107****************

setSliderHeight();

tg
08-11-2004, 03:33 AM
well, in this case, why are you defining a function with no content?
scrollSlider = function (dir);

either you would have a funciton like:

scrollSlider = function (dir){}

which would be silly considering there is no reason for the function cause it does nothing, or you mean to call the function like:
scrollSlider(dir);

don't know about the second problem, but many times if you clear up one error it clears up the others too.

tg
08-11-2004, 03:36 AM
just thought of another option.
is scrollSlider an object (like a component)?
if so maybe that liine should be
slider=new scrollSlider(dir);??

HotWings
08-11-2004, 03:51 AM
No component

its just a movie clip - i guess (im not the best at this...)

the other weird thing is this object is this in the actionscript

----
includefiles.addfile("assetpropflasg.as")
then a ton of stuff...

then sharedObject.getLocal("news","/")
-----

i dont know if thats important or not

but
i did what you said and now the entire app just dissapears, altho no error comes up... but now the newsreader is just not there when you run it...

HotWings
08-11-2004, 04:02 AM
windowdraggerclass? does that ring a bell>?

tg
08-11-2004, 03:36 PM
but
i did what you said and now the entire app just dissapears, altho no error comes up... but now the newsreader is just not there when you run it...


hopefully you didn't do everything i said.... it was meant as different options to try.... so which one option made the error go away?



obviously there is not enough info here to give any meaningfull help. all we can do is guess.

HotWings
08-11-2004, 10:31 PM
would you be open to me sending you more AS to help?
thru email or whatever?

tg
08-11-2004, 10:53 PM
zip and post a sample of what your doing.... either i will try to help you, or someone else will.

HotWings
08-13-2004, 09:01 PM
Ok, ill do that when im home