AS3 ScrollerPane custom class

Posted by stephen on October 2nd, 2008

To use this class you’ll need the “com” folder in the same folder as your .fla, and the createScrollerPane() function.


import com.esiteful.display.ScrollerPane;
function createScrollerPane(paneTarget){
stage.frameRate = 31; // for smoother scrolling
var myScrollerPane:ScrollerPane=new ScrollerPane();
myScrollerPane.target=paneTarget;
myScrollerPane.maskArea=new Rectangle(0, 0, 300, 200);
myScrollerPane.scrollSpeed=4;
myScrollerPane.scrollSpeedMax=80;
myScrollerPane.btnScrollUp=btn_up;
myScrollerPane.btnScrollDown=btn_down;
myScrollerPane.btnScrollLeft=btn_left;
myScrollerPane.btnScrollRight=btn_right;
myScrollerPane.start();
}

Pass the instance name of the object you want to scroll to createScrollerPane(). For example:

createScrollerPane(mc_slide_content);

I’m not sure if it needs to be modified to work with constantly changing the scroll target. It may act funky, or get really slow.

Remember that context is important too, so if you’re adding all of this code to the actions frame on the root timeline, your function call will look more like this:

createScrollerPane(mc_accordian.mc_slide1.mc_slide_content);

I will keep this post updated as the ScrollerPane class changes.

Actionscript 3 MouseEvent.MOUSE_OVER focusing on child object

Posted by stephen on September 29th, 2008

Sometimes my handler function traces the event target as one of the child objects of the actual button, making the button lose focus and triggering the MOUSE_OUT event. I was using the following code:

movieOnStage.buttonMode = true;
movieOnStage.useHandCursor = true;
movieOnStage.addEventListener(MouseEvent.MOUSE_OVER, btnHandler);
movieOnStage.addEventListener(MouseEvent.MOUSE_OUT, btnHandler);
movieOnStage.addEventListener(MouseEvent.CLICK, btnHandler);
function btnHandler(evt:MouseEvent):void{
trace("btnHandler("+ evt +") triggered by "+evt.target.name);
if(evt.type==MouseEvent.MOUSE_OVER){
}else if(evt.type==MouseEvent.MOUSE_OUT){
}else if(evt.type==MouseEvent.CLICK){
}
}

Using object.mouseEnabled property on some of the offending sub clips looked like the first solution, but I really don’t want to specify that on every sub clip. Talk about static.

So, I noticed the MouseEvent had ROLL_OVER and ROLL_OUT events. Using those got rid of the focus issues I was having, but I didn’t know what the difference was.

Most AS3 button examples I see are using the MOUSE_OVER and MOUSE_OUT events, so maybe this will save someone some time when they run into the same issues.

For those interested, I did a little searching on the reason for this. From the docs:

“The purpose of the rollOver event is to simplify the coding of rollout behaviors for display object containers with children. When the mouse leaves the area of a display object or the area of any of its children to go to an object that is not one of its children, the display object dispatches the rollOver event. This is different behavior than that of the mouseOver event, which is dispatched each time the mouse enters the area of any child object of the display object container, even if the mouse was already over another child object of the display object container.”

More info on the MouseEvent:

Dynamic TextFields in Actionscript 3.0

Posted by stephen on September 25th, 2008

I often have issues getting dynamic text to show up at all when I want to animate it in some way. If the text field is created statically, you just have to embed the font in the properties dialog. Here’s how to do it with text fields created dynamically…

  1. Add the desired font to your library and export it as a class. I’ll use Arial for this example.
    1. Right click on the library item and choose “Linkage”.
    2. Make sure Export for ActionScript and Export in first frame are checked.
    3. The Base class field should be “flash.text.Font”.
    4. The Class field should be the name of your font (”Arial”). Not sure how this works with spaces, but I would not use them just to be safe.
  2. Create your TextFormat.
    1. var myFormat = new TextFormat();
    2. myFormat.font = new Arial().fontName; //use the font class name
    3. myFormat.color = 0xA2BCD5;
    4. myFormat.size = 12;
  3. Create your TextField.
    1. var myTF:TextField = new TextField();
    2. myTF.selectable = false;
    3. myTF.embedFonts = true;
    4. myTF.defaultTextFormat = showOnHomeFormat;
    5. myTF.setTextFormat(showOnHomeFormat);
    6. myTF.text = “Here is my text!”;
  4. Create a sprite container for the text field.
    Note: This is only necessary for animating the text or making it a button.

    1. var mySprite:Sprite = new Sprite();
    2. mySprite.addChild(myTF);
  5. Add the sprite to the stage.
    1. root.addChild(mySprite);

For a more complete list of TextFormat/TextField properties and methods, visit the following links:

Installing Alfresco 2.2 on Windows Server 2003

Posted by stephen on August 14th, 2008

There wasn’t a any clear-cut guide for installing Alfresco 2.2 ECM on Windows Server 2003, so I took some notes. Here goes…

  1. Installed jdk-1_5_0_15-windows-i586-p.exe with default options. The JDK is required (I tried it with just the JRE first).
  2. Installed mysql-essential-5.0.67-win32.msi with the following options:
    • Complete
    • Configure Now
    • Standard Configuration
    • Install As Windows Service, Launch Automatically
    • Root Password: ********
  3. Installed mysql-gui-tools-5.0-r12-win32.msi with default options.
  4. Installed OpenOffice_2.4.1_Win32Intel_install_wJRE_en-US.exe with the following options:
    • Custom
    • Disable Java Runtime Environment
  5. Unpacked alfresco-enterprise-tomcat-2.2.0.zip to C:\Alfresco.
  6. Followed these steps to use MySQL database.
  7. Also uncommented lines in custom-repository.properties for db.username, db.password, db.pool.initial, db.pool.max.
  8. Added JAVA_HOME system variable pointing to C:\Program Files\Java\jdk1.5.0_15.

I ran alf_start.bat, waited for the “Started in…” message, and tried http://localhost:8080/alfresco. I got a Tomcat 404 error, and my alfresco.log showed the following (abbreviated) errors:

  • Error creating bean with name ‘dictionaryRepositoryBootstrap’…
  • Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
  • ERROR [org.springframework.web.context.ContextLoader] Context initialization failed

It turns out Alfresco removed the MySQL JDBC driver in 2.2 for licensing purposes, so I just needed to place mysql-connector-java-5.1.6-bin.jar in C:\Alfresco\tomcat\common\lib. Started up fine after that :).

After all of this, I noticed Alfresco would shutdown out of nowhere, I’d get some hs_err_pid logs in C:\Alfresco. The java.exe process was also taking 99% of the CPU and I couldn’t end the process. The machine was basically useless until I restarted. After a bit of back-and-forth with Alfresco support and some digging around, I finally figured out that NetBIOS being disabled was the entire problem. You can enable it in Local Area Connection Properties > TCP/IP > Advanced > WINS.

So, no more freezes, but then I couldn’t access the CIFS. One thing after another, right? I would get a username/password prompt if I tried to access it by \\<ip>\Alfresco, but it didn’t like any of the credentials I entered, and didn’t recognize \\<machinename>A\Alfresco at all. Finally, I found that having “Local Area Connection > Client for Microsoft Networks” disabled was the cause of that.

Both of those settings are not default in a Windows install, but they were set that way in the VM image that was used for my server. Talk about frustrating…

There also seems to be a memory leak in Alfresco that will cause the OutOfMemory Java heap space error in the virtual Tomcat instance. Disabling link validation fixed this for me. You can do that by setting the “pollInterval” to 0 in “C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\linkvalidation-service-context.xml”.

Backup and Restore Dreamweaver CS3 Site Definitions

Posted by stephen on August 9th, 2008

I just got a new laptop with Vista Business on it and spent a while looking for where the Dreamweaver CS3 site definitions are stored. I found this post, which tells where they are on a Mac, but I didn’t see them in the same relative folder on my XP machine. Then, I found this post, which says they’re only stored in your registry on a Windows machine. After thinking “that’s dumb”, I followed these steps to backup and restore them:

  1. Start > Run > “regedit”
  2. Browse to “HKEY_CURRENT_USER\Software\Adobe\Common\9\Sites\”
  3. Right click on the “Sites” folder on the left, select “Export”.
  4. Choose a location and click “Save”.
  5. Move the  resulting “.reg” file to your new destination and double click, clicking “Yes” or “OK” to accept the warning dialogs.
  6. Open Dreamweaver and enjoy :)!

You can also view the list of site definitions in Dreamweaver, highlight them all, then click Export. The reason I didn’t like this method is because it prompts you for a file name for every site, and is equally nagging on import (I did it this way last time I reformatted). If I had 10-15 sites, it wouldn’t be a big deal, but with well over 50 it is not particularly effecient.

It took me a little more than an hour to find this, so I hope it saves someone time!

Installing Magento Commerce on IIS 6

Posted by stephen on August 7th, 2008

A friend recently told me about the open source e-commerce software, Magento. It looked much nicer than osCommerce and ZenCart, so I wanted to give it a try.

Most of what I found involved setting it up in Apache, but I did come across one well-written guide on installing it in IIS.

I got to page 2 of the walkthrough and read, “There is no need to go into details about each extension, but something worth mentioning is that you cannot have both php_mysql.dll and php_pdo_mysql.dll enabled. Magento uses pdo_mysql, and if you enable both, php_mysql takes presedence over pdo_mysql, so keep this in mind.”.

AH! I just jumped through several hoops to get mysql working for Wordpress. And obviously, the generic mysql extension is required by too many things to disable it. I decided to move on with fingers crossed…
** NOTE: I did not run into a conflict with having both enabled. Maybe this has to do with php_pdo_mysql being declared before php_mysql. **

Also, I did not see an ISAPI_Rewrite tab in my IIS Web Sites properties after installing it; although, there was an entry for it in the ISAPI Filters. I went to the Rewrite Manager in Start > Programs > Helichon, and saw pretty much the same output as the guide’s screenshot.

This tutorial states it assumes we downloaded Magento build 1.0.19870.1, but 1.1.2 was out now, so I went for that instead.

After handling a couple of permission issues (described in the guide), the Magento installer started!

I got to the Configuration section and got thse messages:

  • PHP Extension “mcrypt” must be loaded
  • PHP Extension “curl” must be loaded

Those extension lines were already uncommented in my php.ini, so I did some searching. This post says to place libeay32.dll and ssleay32.dll in the windows\system32 directory. I did so, restarted IIS, and the curl message dissapeared.

I figured the mcrypt problem was related to the curl and mysql issues I’d had, where I needed to place the dll directly in windows\system32 (still no idea why IIS doesn’t read from the Path environment variable). So, I copied libmcrypt.dll to my system32 dir, restarted IIS, and it worked!

Now, I could browse around the admin area, but all the links on the front end were broken. I noticed the admin area had index.php/ before most of the paths (like my Wordpress blog), but it was missing from the links in the front end. The guide had me add index.php to a config.php file, so I assumed the same had to be done for the URLs on the front end. Sure enough, http://MYURL/customer/account/login/ didn’t work, but http://MYURL/index.php/customer/account/login/ did.

Currently trying to resolve this on the Magento Forums. I’ll update this post once it’s all squared away.

I have found that disabling the URL Rewrites in Admin > System > Web works, but the URLs aren’t quite as friendly.

**UPDATE 8/10/2008**

As excited as I was to get this up and running in IIS, there was too much of a speed issue. I’m giving SimpleHelix Hosting a try, per the recomendations on a Magento Forum post.

PHP and MySQL on IIS 6

Posted by admin on August 7th, 2008

I went to install Wordpress, but I got this error when I ran wp-config.php:
PHP has encountered an Access Violation at 0202B75A

A test phpinfo() file also displayed a completely blank page. Even a simple echo yielded the same results. Obviously php was not configured correctly.

Turns out the installer is not the way to go. After checking the settings and reinstalling several times, I followed these steps.

Progress! But I was now getting the following error - clearly a permissions issue:

HTTP Error 401.3 - Unauthorized: Access is denied due to an ACL set on the requested resource.

After setting the basic permissions to no avail, I crawled back to google. After another 30 minutes of searching, I came across this post.

The trick was adding the appropriate users with “Read & Execute”, “List Folder Contents”, and “Read” permissions, then clicking “Advanced”, then checking “Replace permission entries on all child objects…”, then “Apply”. Specific to my server, I gave IUSR_TEMPLATE and IIS_WPG access.

phpinfo() now displayed the php config! Considering it’s been as simple as running the installer for me before, this seemed like quite a hassle.

At this point in my Wordpress installation, I excitedly ran wp-config.php, which abuptly stated, “Your PHP installation appears to be missing the MySQL extension which is required by WordPress.”

Horseradish. Neither extension lines for mysql.dll and mysqli.dll were commented.

Then I found this post, which explains the PHPRC environment variable must be set to your php path. This didn’t fix the error, but since I did notice before that the variable was being created by the PHP installer, I left it.

Next, I found a walkthrough that said to copy the libmysql.dll file from c:\php to c:\windows\system32. He also questions why IIS doesn’t just read it from the php directory, since the dir is in the Path environment variable…who knows. I restarted IIS and HOORAH! As you can see, I’m up and running.

Server Error in Application with valid web.config

Posted by admin on August 7th, 2008

I’d installed the .Net Framework 3.5 successfully.
The ASPNET user had full control to my website directory.
I had a correctly formed web.config in the root directory with customErrors mode=”Off”.

I was getting the following error:

Server Error in ‘/’ Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a “web.config” configuration file located in the root directory of the current web application. This <customErrors> tag should then have its “mode” attribute set to “Off”.

<!– Web.Config Configuration File –>

<configuration>
<system.web>
<customErrors mode=”Off”/>
</system.web>
</configuration>

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the “defaultRedirect” attribute of the application’s <customErrors> configuration tag to point to a custom error page URL.

<!– Web.Config Configuration File –>

<configuration>
<system.web>
<customErrors mode=”RemoteOnly” defaultRedirect=”mycustompage.htm”/>
</system.web>
</configuration>

I also had no ASP.Net tab in IIS when viewing a website’s properties.

Well, the solution was simple enough. I just ran “aspnet_regiis -i” from a prompt in the v2 framework directory and restarted IIS.  Now I have an ASP.Net tab, and my site the error in server application is gone.

Since 3.5 has no aspnet_regiis, I didn’t think running the v2 one would be the right thing to do, so I spent quite a while messing around with permissions, reinstalling the framework, etc before running regiis. Silly the routes we take, sometimes…


Copyright © 2007 Stephen Rushing. All rights reserved.