Starting XAMPP Apache and MySQL on startup (Mac)

You can create an Automator application to get Apache and MySQL (and any other XAMPP features, like FTP) to automatically be started when restarting the computer. Start Automator and choose Application. Then drag the “Run shell script” command to the actions window.

Then paste the following code:

echo "[PW]" | sudo -S /Applications/XAMPP/xamppfiles/xampp startapache
echo "[PW]" | sudo -S /Applications/XAMPP/xamppfiles/xampp startmysql

Replace [PW] with your password. This might obviously not be a safe solution as you have to type your user account password in, but if you want it to work, I found this solution.

XAMPP WordPress FTP password on Mac OS X

There are a lot of articles regarding the problems with the FTP connection that WordPress seems to require when running it on localhost on a Mac with XAMPP, mainly this technical solution has been helpful. Problems logging in to the FTP server, knowing what username and password to use, etc.

It did not help me though, but this Terminal trick finally got me past the FTP requirement on my localhost.

sudo chown -R your-user-name:staff wordpress-install-directory

GreenSock TweenLite/TimelineLite caching height of textfield

I was trying to do a smooth animation sequence like this:

  1. Tween TextField alpha to 0.
  2. Tween background MovieClip to height 0.
  3. Change the text.
  4. Tween the background MovieClip to height of the changed TextField.
  5. Tween TextField alpha back to 1.

Unfortunately, when creating the timeline sequence the height of the TextField got “cached” and was not updated on runtime after the text of the TextField had changed. My workaround on this is to append to the timeline after the text has been changed, and not build the whole sequence at once.

Not sure how this would work if there had to be things done after updating the texts, but I assume you can insert at a specific time/label in the Timeline, so that would solve it, I assume.

Textbox SWF

Hm, not in the swf but I added code to remove the tweens once they are done, otherwise it keeps appending to the end of the timeline each time the animation is run.

Code:

import com.greensock.*;
import com.greensock.easing.*;
import flash.events.MouseEvent;
import flash.text.TextFieldAutoSize;

button_mc.addEventListener(MouseEvent.CLICK, update);
reset_mc.addEventListener(MouseEvent.CLICK, reset);
button_mc.buttonMode = true;
reset_mc.buttonMode = true;
popup_mc.x = 0;
popup_mc.y = 50;

popup_mc.body_txt.autoSize = TextFieldAutoSize.LEFT;

var texts:Array = new Array();
texts.push("Cotton candy sweet roll carrot cake candy. Jelly tart tart icing wafer carrot cake biscuit macaroon. Sweet roll pie faworki marshmallow bonbon bear claw. Chocolate caramels cake sweet roll marzipan. Lemon drops icing wafer soufflé brownie brownie candy canes donut. Muffin pastry gummies sweet roll dragée caramels jelly apple pie. Carrot cake fruitcake marzipan fruitcake dragée biscuit tootsie roll cookie. Marshmallow bonbon oat cake. Pudding cake gummies bonbon dessert caramels sugar plum candy bonbon. Wafer candy canes tiramisu brownie jelly-o. Liquorice pastry pie. Toffee dessert pie. Chocolate cake biscuit lemon drops gummies jelly-o cake cake candy canes sesame snaps.");
texts.push("Jelly beans macaroon brownie dragée. Jelly chocolate cake chupa chups caramels pastry sweet roll marshmallow. Liquorice gummies sweet roll. Tart liquorice chocolate faworki cake cake. Icing pastry marzipan jelly-o bear claw cookie ice cream lemon drops. Jelly-o bear claw tart applicake. Ice cream pie sweet tootsie roll gummi bears dessert cotton candy. Bonbon bear claw bonbon pudding. Gummies jelly-o liquorice candy canes sweet roll. Bonbon apple pie marzipan pastry jelly beans marzipan chocolate bar powder. Cake biscuit candy lemon drops marshmallow chocolate cake applicake. Jelly beans croissant pie applicake apple pie sugar plum lollipop.");
texts.push("Tootsie roll croissant liquorice. Dragée chocolate cake macaroon. Chocolate bar gummi bears ice cream faworki wypas. Bonbon bear claw candy cotton candy gummies dessert. Sesame snaps cotton candy marshmallow soufflé jujubes gingerbread pie pudding. Topping icing tiramisu pie bonbon halvah. Fruitcake wypas tootsie roll wafer icing. Brownie topping sweet roll carrot cake faworki chocolate bar gummies cookie chocolate. Bear claw pudding muffin candy canes. Fruitcake croissant chocolate apple pie donut brownie cotton candy jelly sweet roll. Carrot cake lemon drops caramels icing muffin halvah. Croissant biscuit muffin marshmallow. Candy jelly-o candy canes sweet roll caramels wypas gingerbread danish.");

var tm:TimelineMax = new TimelineMax({onComplete: removeOldTweens});
tm.stop();
tm.appendMultiple([new TweenLite(popup_mc.header_txt, 1, {alpha: 0}), new TweenLite(popup_mc.body_txt, 1, {alpha: 0})]);
tm.appendMultiple([new TweenLite(popup_mc.greenBody_mc, 1, {height: 0}), new TweenLite(popup_mc.greenArrow_mc, 1, {y: popup_mc.greenHeader_mc.y + 25})]);
tm.append(new TweenLite(popup_mc, 1, {x: 50}));
tm.addCallback(changeText, 3);

var headerTween:TweenLite;
var bodyBgTween:TweenLite;
var arrowTween:TweenLite;
var textFieldTween:TweenLite;

function changeText():void {
	popup_mc.header_txt.text = "Another headline on this information box";
	popup_mc.body_txt.text = texts[int(Math.random() * 2)];
	popup_mc.body_txt.width = 290;

	// append to timeline
	headerTween = new TweenLite(popup_mc.header_txt, 1, {alpha: 1});
	bodyBgTween = new TweenLite(popup_mc.greenBody_mc, 1, {height:  popup_mc.body_txt.height+10});
	arrowTween = new TweenLite(popup_mc.greenArrow_mc, 1, {y: popup_mc.body_txt.height+10+25});
	textFieldTween = new TweenLite(popup_mc.body_txt, 1, {alpha: 1});

	tm.append(headerTween);
	tm.appendMultiple([bodyBgTween, arrowTween]);
	tm.append(textFieldTween);
}

function removeOldTweens():void {
	tm.remove(headerTween);
	tm.remove(bodyBgTween);
	tm.remove(arrowTween);
	tm.remove(textFieldTween);

	headerTween = null;
	bodyBgTween = null;
	arrowTween = null;
	textFieldTween = null;
}

function update(e:MouseEvent):void {
	tm.play();
}

function reset(e:MouseEvent):void {
	popup_mc.x = 0;
	popup_mc.y = 50;
	popup_mc.header_txt.text = "Header text!";
	popup_mc.body_txt.text = "Blah blah";
	tm.gotoAndStop(0);
}

Smooth scrolling TextField in ActionScript 3.0 with TweenMax from Greensock

Flash My Mind has a tutorial on how to make a blurred scrollbox in Flash with little help from Greensock/TweenMax. It can be used to scroll TextFields and other content. The tutorial can be found here.

In case your content doesn’t scroll all the way back up, I found that this piece of code helps to work things out:

var target:Number = ((myContent.height * 1.2 - myMask.height) * percentage) - myMask.y;

So, multiply your content’s height with 20 % or something like that. It gives you a little bit of margin so you might experiment with this number. Then, instead of adding the y position of the mask to the target number, subtract it.

This did the trick for me!