To 'with' or not to 'with': how is the question ?

Jason Cunliffe jasonic at nomadicsltd.com
Fri Sep 1 17:26:17 EDT 2000


> Do you mean this :
>
> With WhyvisualShit

<snip brilliantly horrible example>

> This seems a good idea in origin (from Pascal), exagerated so
> much that  spoils any traces of programming.
>
> Post it to Comp.lang.perl, they'll probably add to their language.

LOL !!
Thanks Manuel..compelling point well made.

yeay.. how I wish that Macromedia had chosen Python as its Flash 5 script of
choice, or that someone else would make a Python-based Flash killer.. who
knows, maybe in  couple more years we'll have a dynamic Python-SVG tool to
use.. perhaps a spinoff from Blender 7 http://www.blender.nl or Piddle or
Sketch..
But is so much work to get these multimedia apps to this high peformance
slick stage plus the  level of player performance/distribution/hype.

Meanwhile XML-based Scalable Vector Graphics [SVG] is coming along nicely.
Check out the pages and demos on Adobe's site in case you are interested:
http://www.w3.org/Graphics/SVG/SVG-Implementations
and links
http://www.adobe.com/svg/community/external.html
or this one
http://www.pinkjuice.com/SVG/SVGlinks.htm


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::
FYI here is the Flash 5 example I was just reading:

The following example sets the x and y properties of the someOtherMovieClip
instance, and then instructs someOtherMovieClip to go to frame 3 and stop:

with (someOtherMovieClip) {
 _x = 50;
 _y = 100;
 gotoAndStop(3);
}
The following code snippet is how you would write the preceding code without
using a with action:

someOtherMovieClip._x = 50;
someOtherMovieClip._y = 100;
someOtherMovieClip.gotoAndStop(3);
This code could also be written using the tellTarget action:

tellTarget ("someOtherMovieClip") {
 _x = 50;
 _y = 100;
 gotoAndStop(3);
}
The with action is useful for accessing multiple items in a scope chain list
simultaneously. In the following example, the built-in Math object is placed
at the front of the scope chain. Setting Math as a default object resolves
the identifiers cos, sin, and PI to Math.cos, Math.sin, and Math.PI,
respectively. The identifiers a, x, y, and r are not methods or properties
of the Math object, but since they exist in the object activation scope of
the function polar, they resolve to the corresponding local variables.

function polar(r){
 var a, x, y
 with (Math) {
  a = PI * r * r
  x = r * cos(PI)
  y = r * sin(PI/2)
}
trace("area = " +a)
trace("x = " + x)
trace("y = " + y)
}
You can use nested with actions to access information in multiple scopes. In
the following example, the instance fresno and the instance salinas are
children of the instance california. The statement sets the _alpha values of
fresno and salinas without changing the _alpha value of california.

with (california){
 with (fresno){
  _alpha = 20;
 }
 with (salinas){
  _alpha = 40;
 }
}








More information about the Python-list mailing list