This is an example how to create a typeing effect without having to use masks. (you can repeat the text or add a pipe character )
import mx.utils.Delegate;
class myfolder.typingText { // replace myfolder with the folder structure you use
private var delayTime:Number;
private var destinationMc:MovieClip;
private var messageText:String;
private var currentChar:Number;
private var includePipe:Boolean; // include pipe character after text
private var doRepeat:Boolean; // repeat typeing after 5 sec
public function typingText(mcBot, mcRoom){
this.delayTime = 50;
this.destinationMc = null;
}
public function typeText(){
var dest = this.destinationMc;
if (dest && dest.html != null) {
dest.html = true;
dest.text = this.messageText.substr(0, this.currentChar);
if(this.includePipe)
dest.text = dest.text + "|";
var myText = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed vel est. Cras convallis quam non diam. ";
// textarea
var typing1 = new typingText();
typing1.startTyping(myText,200, taTypingText,true, false );
// dont use pipe in text area because a CR is generated and pipe end up under the last line
//inputtext
var typing2 = new typingText();
typing2.startTyping(myText.substr(0, 40),80, tiTypingText, true, true );
// textfield
var typing3 = new typingText();
typing3.startTyping(myText,500, dtTypingText, false, false );
For javascripters it is well know that IE browsers have problems with memory leaking.. but this problem took me while to find..
On several sites I attach events based on the classname of an element. I have to remove these attached events on unload. So I did. but somehow I always have one element leaking in IE ( mostly an element that i didn’t attach anything on it, so that puzzled me)
The problem was in the getEvent function I used to convert a fired event to W3C standard. this was my code:
function getEvent(e) {
if (e == null) {
e = window.event;
}
if (e == null) {
return null;
}
if (!e.target) {
e.target = e.srcElement;
}
// get parent if nodetype is textnode
if (e.target.nodeType == 3) {
e.target = e.target.parentNode;
}
if (!e.stopPropagation) {
e.stopPropagation = function() {
e.cancelBubble = true;
}
}
if (!e.preventDefault) {
e.preventDefault = function() {
e.returnValue = false;
}
}
return e;
}
But calling this function caused the leak.
when I changed this function to this underlying code the leak was gone…….hooray!!!
/**
* Returns an event object that is normalized for cross-browser support.
*
* @param {Event} e Event object. Is allowed to be null.
* @returns {Event} A normalized event object.
*/
function getEvent(e) {
if (e == null) {
e = window.event;
}
if (e == null) {
return null;
}
if (!e.target || !e.stopPropagation || !e.stopPropagation) e = W3CEvent(e);
return e;
}
/**
* Returns a synthetic event object with partial compatibility with W3C events
*
* @param {Event} e Event object.
* @returns {event} The partial W3C event object.
*/
function W3CEvent(e) {
if (!e) e = window.event;
var event = {
_event: e, // In case we really want the IE event object
type: e.type, // Event type
target: e.target?e.target:e.srcElement, // Where the event happened
relatedTarget: e.fromElement?e.fromElement:e.toElement,
keyCode: e.keyCode,
When you want a folder to be back-upped inside a folder with a datename for version control. It is very easy to do this with apple’s own automator.Go to automator (in your application folder or with right mouse click on a finder element -> more -> automator) and select the following actions:
Ask for Finder Items
Create Archive
New Dated Folder
Enter a name for your zipfile in the create archive folderchoose a dateformat in the new date folder actionselect ‘move passed items to the new folder’ in the new date folder action.and your done.