-
Trouble with numbers as instances
For a school assignment i planned to recreat a mac system for a PSP. In doing that i have created the boot screen and login. I also wanted a dock and found one on the internet with source coding :O
http://jrgraphix.net/research/flash_dock.php
I Made an animaition for one of the icons (bouncing) and want it so when i click the icon, it bounces, HOWEVER, when I say _root.dock.1.Play(); it says Syntax error. Which i guess is because of the number. This, i think, is introduced within CS3 which is very annoying. How can I either edit the source code to load a,b,c,d instead of 1,2,3,4? This is the source code of the dock
Code:
onClipEvent(load){
_quality = "BEST";
var margin = 2; // tray margin
var min = 32; // icon size at its smallest
var max = 50; // icon size at its largest
var span = 2.5 * min; // radius of influence
var spacing = min + 1; // icon spacing
var n = 7; // number of icons
var speed = 0.15;
var _MC = Math.cos;
var _MS = Math.sin;
var _s = max - min;
var state = 0;
var piSpan = Math.PI / span;
var center = new Array();
for(i = 1; i <= n; i++){
this[+i]._y = - margin;
center[i] = (2 * i - n - 1) * spacing / 2;
}
tray._height = min + 2 * margin;
this._alpha = 0;
}
onClipEvent(enterFrame){
if(this._alpha < 100) this._alpha += 10;
if (state == 0 || state == 1) temp = false; else temp = true;
if(inside) state = Math.min(1, state + 0.2); else state = Math.max(0, state - 0.2);
if(x != _xmouse || y != _ymouse || temp) {
var x = _xmouse;
var y = _ymouse;
var x1 = tray._x;
var x2 = x1 + tray._width;
if(!temp){
if( x < x1 || x > x2 || Math.abs(y) > altitude ) inside = false; else inside = true;
}
var altitude = min + 2 * margin + _s * state;
for(i = 1; i <= n; i++){
lo = center[i] - state * span;
hi = center[i] + state * span;
if(x <= lo) iX = hi; // mouse on the left, icon to the right
if(x >= hi) iX = lo; // mouse on the right, icon to the left
if(x > lo && x < hi) { // icon is influenced by mouse
fi = piSpan * (hi - x); // 0..2pi
cfi = _MC(fi / 2); // 1..-1
sfi = _MS(fi) / 20; // horizontal compensation
iX = center[i] - state * span * (cfi + sfi); // centrum ± span
iSize = _s * (1 - cfi * cfi); // icon resize
}
else iSize = 0;
_scale = 100 * (min + state * iSize)/128;
this[+i]._xscale = this[+i]._yscale = _scale;
this[+i]._x = iX;
}
tray._width = this[n]._x - this[1]._x + this[1]._width/2 + this[n]._width/2 + 2 * margin;
tray._x = this[1]._x - this[1]._width/2 - margin;
}
}
-
Flashmatics
no it isnt new ..instance names cannot start with a number .. change your instance names
-
Well it got rid of one Syntax error and made the text blue which is a good thing, still error though
-
Flashmatics
can you be more specific? what is the error? can you highlight the relevant part of the code .. so we know which portion you are talking about.. i dont see any _root.dock.1.Play(); in the above code P.S it should be .play() anyway not .Play()
-
the above code is the source code for the dock, I am wanting to replace the 1,2,3,4 to a,b,c,d unless there is a way to play numbers as instances. So it goes, ROOT,DOCK,3 (instance name),
here is the code for number 3 in Root/Dock/Frame (actions layer with single frame one it)
onRelease function = {
dock.3.play()
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|