ОТМЫКАНМИЕ ФИЧ
==================================================================================
trace(TextField.StyleSheet); // undefined
ASSetPropFlags(TextField,"StyleSheet", 0, 1024);
trace(TextField.StyleSheet); // [type Function]
You are welcome to continue arguing with me but, if you are using the wiki
page as a reference, you should know that I wrote about 90% of the text on
that page ;-)
The number is not just a digit 0-8, it is interpreted as a set of binary
flags. Any combination of 1 | 2 | 4 | 8 | 256 | 512 | 1024 have known
meanings. I haven't gotten around to updating the higher values because some
flags seem to work differently in different player versions, or are just
odd, and I want to be certain.
The fourth param unsets the attribute specified by its flags, provided that
the corresponding flag is not set in the 3rd param.
IMG | SWF в текстовых полях
==================================================================================
IMG тэг. Автоматически обтекаемый текстом. С поддержкой аотрибута "align". Причем в качестве каринки модет быть загружен SWF-Файл.
http://www.ericd.net/garden/image_text_smile.swf
ПРИБАВКА В СКОРОСТИ
==================================================================================
слэш-нотация больше не действует быстрее, чем точечная
КОНТЕКСТНОЕ МЕНЮ
==================================================================================
Param1: name of menu item
Param2: callback method
Param3: if there is a seperator line before the item
Param4: enabled
Param5: visible
itm3 = new ContextMenuItem("Item 3", itemHandler,false,false,true);
itm4 = new ContextMenuItem("Item 3", itemHandler,false,false,false);
СТАРЫЕ ГЛЮКИ
==================================================================================
Глюк с протгрыванием звуека сохранился То есть событие onSoundComplete наступает, как и прежде, с опозданием.
Anyone else get this bug...?
1. _root.imgTester.htmlText = "
"; // doesn't work
2. _root.imgTester.htmlText = "a
"; // does work
So basically the
tag doesn't seem to work when nothing else is in the
TextField.
Поддержка правого клика по ссылке в текстовом поле
==================================================================================
I guess the problem is one of scope. As Bobby Pedal pointed out, when
using the "open"-action from the contextmenu on asfunction-links flash
tries to invoke the given function from the root-timeline, not from the
timeline the textfield is on.
example:
this.createEmptyMovieClip("mc", 1);
mc.createTextField("txt", 1, 0, 0, 200, 100);
mc.txt.html = true;
mc.txt.htmlText = "you should click here.";
_root.myfunc = mc.myfunc = function(){
_root.mc.txt.text = "function in timeline "+this+" called";
}
CSS
==================================================================================
very nice. Have you been able to make any sense of the other CSS methods
available to a stylesheet object,
parseColor
parseCSSFontFamily
parseCSSInternal
parseCSS
transform
doTransform
etc...
In regards to
support, it seems odd that macromedia would only
allow left and right align. I thought one definite use for the new tag
would be to very easily implement emoticons for chatting, although that
doesn't seem too likely given the limited support? Any thoughts?
...
...
Still playing since my other half is watching the Robbie Williams concert on
TV ;o) Here's what I've learned...
The setStyle() method of the StyleSheet object allows you to set individual
styles. It takes two parameters (well, two that I've figured out anyway)...
StyleSheet.setStyle(class_str, style_obj);
class_str is a string identifying the class name of the style to set.
style_obj is an object containing the style definitions.
So, If I wanted to have all anchor tags displayed in red, and hover in blue
with an underline, I'd so this...
my_css.setStyle("a", {color:"#ff0000"});
my_css.setStyle("a:hover", {color:"#0000ff",textDecoration:"underline"});
Note the camel case of 'textDecoration' - it's not 'text-decoration' as it
is in CSS! This will also apply to other CSS elements with a dash in the
name, like fontFamily, fontSize, marginLeft, marginRight etc.
Note that the setStyle() method _doesn't_ seem to return false if there's an
error parsing the object, whereas StyleSheet.parseCSS() will if it
encounters an error in your CSS!
You can use the StyleSheet.getStyle() method to get a style object for a
particular class!
The transform() and doTransform() methods look very interesting. I'm off to
play some more!
...
...
Not at the moment as I'm still improving it, but the code that does all the
work is just 4 lines long...
function updateOutput() {
myStyleSheet = new TextField.StyleSheet();
myStyleSheet.parseCSS(css_txt.text);
output_txt.styleSheet = myStyleSheet;
output_txt.htmlText = src_txt.text;
}
This function is called when the [Update output >>] button is pressed. It
creates a new StyleSheet object, uses that to parse the CSS in the css_txt
textfield and then sets it as the active stylesheet for the output_txt
textfield. All that's left then is to copy the text from the src_txt
textfield into output_txt.
One killer thing to watch out for is that Flash seems to be case sensitive
now, at least for the TextField properties. Don't forget to use proper
camel-case! Also, don't forget to patch your .swf files or the new features
won't work at all ;o)
Чувствительно к регистру:
text-decoration: underline; // works
but
text-decoration : underline; // doesn't
http://newnav.xd.nl/flash7/stylesheetload.swf
http://www.dynamicflash.co.uk/index.php?m=200308#
Еще пример: http://www.3wgraphics.net/projects/john/flash7tests/test7css.html
Работа в видео
==================================================================================
Hi, long time no post... We'd love to be able to utilize Flash video but
we use long
videos typically off of CDROM and the memory requirements are huge (cuz
Flash
loads the whole movie into RAM before playback begins).
You guys know if there's been any improvement in the utilization of
memory in
Flash video playback?
ПРОЧИЕ ФИЧИ
==================================================================================
Tons of features.
New features:
Actually seen working examples:
- right mouse click menu is customisable
- scroll wheel support for textfields
- right mouse click on links in textfields supports open in new window
- img tag works in textfields
MovieClip Preloading API
MovieClip Depth Management API
PrintJob Object
Scrollwheel support
TextFlow Aroud Image support
CSS support
Context menu support
setClipboard
TextSnapshot
XML Class extended
Text Metrics API
Lots of other features..
If u have flash 7 player beta installed, check some examples here
CLIPBOARD
======================================================
http://siliconpur.hypermart.net/flash7/setClipboard.html
better list of features:
http://www.code.audiofarm.de/XTrace/xtrace_player7.html
Remy
ASSetPropFlags
==================================================================================
Ok, basic flags:
1 - dontEnum (hide from for..in loops)
2 - dontDelete
4 - readOnly
So this will make make all properties read only and protect them from
deletion:
ASSetPropFlags(obj, null, 4|2);
This will unset the readOnly flag, but will not touch the dontDelete or
dontEnum flags:
ASSetPropFlags(obj, null, 0, 4);
"New" property flags:
128 - hide from F5
256 - F5 only (??)
1024 - F7 only
Make properties appear undefined in everything lower than F7:
ASSetPropFlags(obj, null, 1024);
Undo above operation, to make properties visible to F5 and F6:
ASSetPropFlags(obj, null, 0, 1024);
> In all your examples if the 3rd param is 0 then you
> can set the 4th param. Why is this???
>
> Ex: ASSetPropFlags(obj,"f",0,4);
> You never see this ASSetPropFlags(obj,"f",1,4);
>
This sets the dontEnum flag and unsets the readOnly flag at the same time.
You don't see it it because that is quite a rare thing to want to do.
> And whats this:
> ASSetPropFlags(obj, null, 4|2);
> the |?
>
| is the bitwise OR operator (see your AS dictionary). It would also work
to write 4+2, but the | explains better what is really happening. ie 4 =
0b0100, 2 = 0b0010, so 4 | 2 = 0b0110 = 6.
> 3 posibilities 3x3 = 9, 0-8. What does 8 equal that
> the others havent already covered.
>
8 is needed because 0 has special meaning n F5 (it adds a "length" property
to
an object). 8=0b1000; the last 3 bits are 0, which are what matter.
> So you are saying the 4th param is just like the 3rd.
> By useing the 3rd and 4th param you can execute 2
> commands at once. IE) allow rewrite, while hiding the
> children. The 4th param can also go a bit higher, ie
> 256,512,1024, and extend its command over various
> versions of flash.
>
> This is were the fourth param gets shacky becuase it
> contains values no longer available in the 3rd param.
This is what I was trying to explain. All flags can be used in both
parameters. The 3rd param sets the flag to true, the 4th param sets it to
false. Simple as that.
ASSetPropFlags(Color.prototype,null,0)
is the same as
ASSetPropFlags(Color.prototype,null,7,7)
or
ASSetPropFlags(Color.prototype,null,1)
is the same as
ASSetPropFlags(Color.prototype,null,6,6)
- John-David
>>
Not quite ;-)
The 3rd param takes precedence over the 4th.
So
ASSetPropFlags(Color.prototype,null,7)
is the same as:
ASSetPropFlags(Color.prototype,null,7,7)
is the same as:
ASSetPropFlags(Color.prototype,null,7,0)
Peter
> I wonder can the third param be skipped
>
> ASSetPropFlags(Color.prototype,null,,7)
No, AS does not permit you to omit arguments. Pass 0 or null.
> Can the third param also be
> ASSetPropFlags(Color.prototype,null,1024)
Yes.
Массивы
==================================================================================
First of all, speed. Array.sort() is one of the methods which has an
extraordinary speed boost-up in this version of the Flash Player. Tests show
that it's speed lines up with the common browser's equivalent JavaScript
method, and even faster than some, such as Microsoft Internet Explorer.
But besides speed, there's also a brand new feature to Array.sort(). Along
with the normal parameter it has always used to accept, a custom sorting
function, Array.sort() can also accept an integer in the range of 1-31. This
integer value, is a bitwise-combination of a few sorting options which
enhance the use of the sort method. True, this options could probably be
implemented with the custom sort function. But, these options are much
faster than any implementation we could come up with, as their hard-coded
into the player (so it seems).
So, what are this options? I'm sure you've all noticed the new constants in
the Array object. This constants are bit-values, which allow you to easily
combine between them using bitwise-or (the | operator). Here's a quick list
of the options and their effect on the sort:
Array.CASEINSENSITIVE -- Value: 1 -- This causes strings to be sorting in a
case-insensitive matter. Normally, capital letters would get sorted before
lower-case letters. This tells sort to ignore the case of letters while
sorting.
Array.DESCENDING -- Value: 2 -- This sorts the array in a descending order.
This is theoretically the same as using Array.reverse() after sorting the
array (I have not tested which is faster. It's possible that one implements
the other, so their speed could be equivalent.)
Array.UNIQUESORT -- Value: 4 -- This was a tough nut to crack. I spent quite
some time trying to figure this one out. I expected it to sort the array
while removing reoccurring values, but that wasn't the case. It seems it
only sorts an array which doesn't have such reoccurring values, and returns
0 if such values exist. I'm assuming it uses a different sorting method that
relies on the fact that such values don't exist. But I'm still not positive
this is the case, as it seems that even for appropriate arrays, the normal
sorting method is still faster than using this method.
Array.RETURNINDEXEDARRAY -- Value: 8 -- This has an interesting behavior,
which is quite complicated to explain, but makes sense once you understand
it. What it does, is return an array, which holds array indexes. This array
indexes are the indexes of the values of the array that would hold that
position in a sorted array. Note that this does *not* actually sort the
given array, and leaves it as it is. View the examples at the bottom for
more information.
Array.NUMERIC -- Value: 16 -- This sorts values by their numeric values.
That means that anything is converted to numbers. Strings are sorted by the
character's ASCII values.
--- Examples -------------------
arr = ["a","c",1,"B",2,"e",3,"D"];
arr.sort(Array.NUMERIC);
trace(arr); // output: 1,2,3,B,D,a,c,e
arr = ["a","c","B","e","D"];
arr.sort(Array.CASEINSENSITIVE | Array.DESCENDING);
trace(arr); // output: e,D,c,B,a
arr = ["a","c","B","e","D"];
var indexArr = arr.sort(Array.RETURNINDEXEDARRAY);
trace(indexArr); // output: 2,4,0,1,3
// What does this mean? It's a sort of Hash-table comparing the original
indexes to the new indexes of a sorted array.
// This would result in the sorted array:
var sortedArr = new Array();
for (var i=0; i
myPrintJob = new PrintJob;
myPrintJob.start();
myPrintJob.addPage(rect);
myPrintJob.send();
"rect" is a movieclip placed on the stage
what i dont get to work is the paperSize and the orientation
MP3 ID3v2
==================================================================================
there is support for id3 v2 tags in flash player 7. (tags are on
beginning of mp3 file instead of in the end)
this.createTextField("output_txt", 1, 100, 100, 400, 300);
output_txt.border = true;
song = new Sound();
song.onLoad = function (success) {
var theSound = this;
function pollForDuration () {
if (theSound.duration > 0) {
// Display ID3v2 information.
output_txt.text += "Title: " + theSound.id3.TIT2 + "\n";
output_txt.text += "Artist: " + theSound.id3.TALB + "\n";
output_txt.text += "Album: " + theSound.id3.TCOM + "\n";
output_txt.text += "Year: " + theSound.id3.TYER + "\n";
theSound.start();
clearInterval(intID);
}
}
if (success == true) {
var intID = setInterval(pollForDuration, 100);
}
}
song.loadSound("myFile.mp3", false);
undefined.toString
==================================================================================
But how it works is quite strange - undefined doesn't have a toString method
but when concatenated with a string, itself is converted to the string
"undefined".
A little example:
var foo;
_root.createTextField("out_txt", 1, 0, 00, 400, 300);
out_txt.border = 1;
out_txt.setNewTextFormat(new TextFormat("Courier New", 12));
out_txt.text = "1: undefined \t\t\t\t\t\t:"+undefined+"\n";
out_txt.text += "2: undefined.toString \t\t\t\t:"+undefined.toString+"\n";
out_txt.text += "3: undefined.valueOf \t\t\t\t:"+undefined.valueOf+"\n";
out_txt.text += "4: undefined == null \t\t\t\t:"+(undefined == null)+"\n";
out_txt.text += "5: undefined == foo \t\t\t\t:"+(undefined == foo)+"\n";
out_txt.text += "6: undefined == \"\" \t\t\t\t:"+(undefined == "")+"\n";
out_txt.text += "7: undefined == \"undefined\" \t\t:"+(undefined ==
"undefined")+"\n";
out_txt.text += "8: \"\"+undefined == \"undefined\" \t:"+(""+undefined ==
"undefined")+"\n";
out_txt.text += "9: undefined == 0 \t\t\t\t\t:"+(undefined == 0)+"\n";
out_txt.text += "10: undefined == NaN \t\t\t\t:"+(undefined == NaN)+"\n";
out_txt.text += "11: undefined === null \t\t\t\t:"+(undefined ===
null)+"\n";
out_txt.text += "12: undefined === foo \t\t\t\t:"+(undefined === foo)+"\n";
out_txt.text += "13: \"\"+undefined === \"undefined\" \t:"+(""+undefined ===
"undefined")+"\n";
Also one realises that the other equivalences still hold as they did in
Flash 6.
If you do not convert the produced swf to Flash 7, lines 1-3,8,13 will
change as undefined converted to the empty string in Flash 5 and 6.
I believe the reason for this is to comply with the ECMA-262 standard - but
I'm not sure.
// Morten Barklund
// Software Engineering
Oops, I failed to see the fatal consequences of this "little" thing.
From now on, you HAVE TO initialize variables if making flash 7 content.
See this example:
_root.createTextField("out_txt", 1, 0, 00, 400, 300);
out_txt.border = 1;
out_txt.setNewTextFormat(new TextFormat("Courier New", 12));
var foo;
out_txt.text = "1: foo: "+foo+"\n";
delete foo;
var foo;
out_txt.text += "2: foo++: "+(foo++)+"\n";
delete foo;
var foo;
out_txt.text += "3: ++foo: "+(++foo)+"\n";
delete foo;
var foo;
out_txt.text += "4: foo+=1: "+(foo+=1)+"\n";
delete foo;
var foo;
out_txt.text += "5: foo+=\"1\": "+(foo+="1")+"\n";
delete foo;
/* output is:
1: foo: undefined
2: foo++: undefined
3: ++foo: NaN
4: foo+=1: NaN
5: foo+="1": undefined1
*/
As one increments a undefined variable, the result is not 1 but NaN, as it
tries to add "undefined" and 1 resulting in NaN.
Also if adding strings to undefined variables, the word "undefined" is then
the start of the string.
Of course one should always properly initialize variables, but now you're
forced to do it - or face the serious and certainly unwanted consequences!
/Morten Barklund
БЕЗОПАСНОСТЬ
==================================================================================
You not only get the error when you try access different subdomains. You
also get it if you use a URL with embedded htaccess username and
password:
username:password@www.mydomain.com
(already reported to Macromedia)
Rob
_lockroot looks interesting, perhaps that disallows
any loaded clips from:
a) loading a new clip into _root and replacing it
or
b) adding anything to _root
or
c) removing or changing anything on _root
Mouse.onMouseWheel
==================================================================================
I don't think this has been posted, so here it is. The Mouse object now
broadcasts a new event called onMouseWheel (yes, that has been posted
before). I just noticed that the event has two parameters, the first is the
wheel delta, the amount of lines scrolled (according to the speed of scroll
and the windows configuration), and the second is the textfield the wheel
was used on, or 'undefined' if not availble. The other Mouse events seem to
be the same, same for the Key events.
var mouseListener = new Object();
mouseListener.onMouseWheel = function(wheelDelta,txtField) {
trace("the field "+txtField._name+" has been scrolled by "+wheelDelta);
}
Mouse.addListener(mouseListener);