Observing and requesting better support for panning (horizontal as well as vertical scrolling) in Flash player across all OS platforms and runtimes via ubiquitous input devices.
A couple of months ago, during a particularly busy period of work, I started to suffer some quite strange symptoms with my MacPro. Essentially, ‘sometimes’ if the system went to sleep, it was not possible to properly wake it up. It was apparent that the machine was starting up, but there was no video signal to either of the two monitors attached. One being an Apple 23 inch LCD. The other being an old CRT. The only way to get back to a working condition being to force-shutdown and restart the system.
My first suspect was one of the monitors – possibly the LCD. But trying them individually and swapping the connectors over made no difference.
The next suspect being the video card. Taking a look inside, there was a shocking amount of dust build up. I removed the card and gave it a good clean. Unfortunately this didn’t solve the problem. Over the next few weeks the occurrence increased in frequency to the point where one Sunday, after 7 or 8 reboots, it was time for more drastic action.
I had found a discussion on the Apple support site which echoed the symptoms and seemed to confirm the video card being at fault. My Mac was out of warranty and I needed it working for the next day and so trekked to the Regent Street Apple Store. Really busy store – the worse part was trying to get the attention of a member of staff. But then it was plain sailing. I explained the issue. While he suggested it might make sense to bring in the Mac to be checked – doing so would have been a real pain, run up cost and taken ages. I was pretty confident in my diagnosis. The only option available was an upgrade – which I was pretty happy with. From reading the rest of the support discussion I really didn’t want to replace like with like.
So, £300 lighter I trekked back home with a Apple Mini-DVI to DVI Adapter and a 512Mb ATI Radeon HD 4870. Very releived that the item was in-stock.
It dwarfs the old card, taking up two slots and full width. Installation was not too hard. The worst bit trying to connect the extra power cables to the mother-board.
Closed the machine and restarted. The new card was picked up immediately. No installation of drivers required. Note: I had been a little worried that drivers may be required as I had previously considered upgrading to an NVIDIA® GeForce® GTX 285, for which I read that it was vital to install the drivers prior to installing the card. Something difficult to achieve if the old card is dead!
Summing up – very happy so far with the new ATI Radeon HD 4870 which has been running faultless for the last couple of months, and looking forward to more software making user of the GPU, particularly from the likes of Adobe.
UPDATE 10-Dec-2009: I’m pretty convinced now that this is an editor bug, not a Mac OS X bug. Essentially the editors are using default OS behaviour which I think is tailored for natural language editing rather than programme-code editing. Original post follows…
I’m currently finding in some applications that “word1.word2.word3” is being treated as a single word as far as the Option-Left Arrow and Option-Right Arrow is concerned on my Mac. This keyboard shortcut should hop word by word. But currently hops from one end to the other. Not an issue for most users, but pretty serious for a programmer working with dot-notation syntax.
I first experienced this working with ActionScript in Adobe’s Flash Builder Beta 2 and logged a bug report, but further investigation reveals that some unrelated applications show the same behaviour. I have now logged a bug with Apple, but in the meantime I would be interested to know if others are experiencing the same? Or if you are running 10.6.1 and not seeing this issue? Please add a comment – I’m still trying to work out if it is something installed on my system. I don’t think it is basic user preferences as I am seeing the same in another user-account on this system.
Editors incorrectly treating “word1.word2.word3” as a single word re opt-left and opt-right:
- FlexBuilder 3 MXML and AS editors
- FlashBuilder 4 Beta2 MXML and AS editors
- Apple Mail
- Apple OS TextFields including:
- Finder window find-file
- Safari: form-textfields & google search field
Editors showing correct opt-left opt-right behaviour:
- Adobe Flash CS4 IDE ActionScript Editor
- Adobe DreamWeaver CS4 editor
- Apple XCode editor
- Apple Finder – filename clicked and editable when renaming
- Firefox form-textfields and goodle search field
The problem: In Flex, how to overlay the video with something (e.g. a logo or caption) and keep the overlay relative to a corner of the actual video rectangle. Sounds like it should be a simple matter of creating a container and layering in the VideoDisplay instance and the over lay instance ? But…
In each of the following samples:
- We have an <mx:Panel> which has been extended to be reposition-able (drag the title bar) and resizable (drag the lower-right corner).
- The panel contains an <mx:VideoDisplay> with 100% width and height
- The panel also contains an overlay graphic – in this case using <mx:Image>
- To view the samples you need to have Flash Player 10.0.32. or higher installed. You can get the latest Flash Player from here: http://get.adobe.com/flashplayer/
- The source-code for these samples can be downloaded
- View source with a right-click on each of the samples
Video Display overlay Sample 1
In our first sample we simply place our overlay image using attributes ‘top’ and ‘right’ to keep the overlay’s top-right corner to 10px in from the VideoDisplay top-right corner.
It basically looks fine until you hit the play button and start resizing the panel.
As you can see the actual video within the VideoDisplay is constrained by its rectangle and depending on the differing aspect ratios, there will either be black space at the sides or the top, and our overlay is faithfully anchored to top right corner of the VideoDisplay and looks odd unless the aspect ratios are equal.
So how to solve this?
Looking at the documentation for VideoDisplay, there are many width and height properties to play with, however none of these relate to the current width and height or position of the contained video rectangle. You might think while looking at the documentation that the videoWidth and videoHeight properties might give the values we are after, but not so. They only return the ‘original’ width and height of the loaded video.
Fortunately the OpenSource nature of the Flex SDK and the magic of, holding the command key on a Mac (control key on a PC) with the cursor over the <mx:VideoDisplay> opening tag, then clicking it as it underlines, (using in Flash Builder or Flex Builder) will open the source for the VideoDisplay component within a new editor. Browsing through the code you will see at line 198:
mx_internal var videoPlayer:VideoPlayer = null;
It is this videoPlayer instance who’s properties we need to monitor to calculate our overlay’s position. The instance is not generally exposed through the VideoDisplay component’s api. Nor is it documented. However since it has been placed in the mx_internal name space, we can actually access it with namespace notation…
Where we replace ‘attribute’ with the property name we are after, so the following would be of use to us…
Video Display overlay Sample 2
In this second sample, we create a positionOverlay method and call it from the resize event of the VideoDisplay component. Within positionOverlay we use the name space notation to get the videoPlayer properties and use some basic maths to reposition our overlay based on the top-right corner of the videoPlayer instance rather than the videoDisplay instance.
Additionally we call positionOverlay from our applicationComplete handler to set the initial position.
This basically seems ok, but play with it for a while and it is clear that something is wrong…
- Resizing slowly, seems ok
- Resizing quickly, and there seems to be some lag in the position of the overlay
- Release the resize handle while resizing quickly and the overlay can be left behind in completely the wrong place
Having traced the videoPlayer instance properties from within the positionOverlay handler, it is apparent that while the videoDisplay properties are correct, the videoPlayer properties are as they were previously. i.e. as they were rather than as they shall be.
Video Display overlay Sample 3 – This one works properly!
This is where Player version 10 comes in. It added Event.EXIT_FRAME. (If your project targets a player older than 10, you will not see this event in your code assist.) If we use the exit frame event to defer the call to overlayPosition, we can then get measured values from videoPlayer and correctly position the overlay.
To do this I have created a new method positionOverlayOnExitFrame who’s job is to add an EXIT_FRAME listener who’s handler will be overlayPosition. The first job of which is to remove the listener, so that it only gets called once. By using a listener we need to change the interface of overlayPosition to accept an Event argument. But we are not interested in the event information and we still wish to call positionOverlay directly, so we have allowed the argument to have a null default.
Playing with the resize handle now, no-matter how quickly it is moved, shows no lag, and always drops in the correct place.
Finally, just to re-iterate, source code zip for these examples is here.
Note: These samples were built against Flex SDK version 3.4.
Note: I haven’t found any official documentation relating to when Event.EXIT_FRAME arrived in the player runtime. The Flash CS4 documentation for Event.EXIT_FRAME indicates player 9. However unless you target player 10 in Flex/Flash Builder, you will get compile errors. If anyone has accurate references, please post to the comments – thanks.
Note: When you look at the source view, it appears ragged. This is because in creating the HTML, Flash builder simply converts tab characters to four space characters. Clearly not every tab in my code actually represents 4 characters and therefore what should look like neat columns becomes ragged. I have filed a bug/enhancement request. If you too would like this fixed, feel free to add your vote to FB-23060.
Ok so CMD-SPACE is the default short cut to launch Spotlight. But I wanted that combo for ‘content assist’ with Flex/Flash Builder. Until installing Snow Leopard, that is what I had for a few years, and Spotlight relegated to CTRL-SPACE. However since SnowLeopard, the CMD-SPACE combo is not transmitted to Flash Builder. I assume this is down to Snow Leopard somehow reserving the combination. So begrudgingly I have returned to defaults…
Spotlight : CMD-SPACE
Flash Builder content assist : CTRL-SPACE
Slightly off-topic for this blog, but…
Decided to dig out my old Tascam Porta 05 ministudio in order to digitise some old 4-track recordings. But, found that the play heads seemed to be stuck in the forward position. Full symptoms and notes:
- Power on ok
- Impossible to insert a cassette due to the position of the heads
- Can hear the motor (which turns all the time power is on – this is normal)
- Motor responds correctly to the pitch control
- Fast forward button works – spins the central right capstan
- Rewind button works – spins the central left capstan
- Tape heads in forwards position, but the rubber wheel in front of the stop button is not forward enough to press against the metal capstan
- The metal capstan, which should normally be spinning all the time the machine is powered is not actually spinning
- Pressing play or record buttons does nothing – the central capstans that would fit into the tape spindles do not turn
I did google around trying to find a solution. I did find a couple of people with the same problem, but no solution posted. I googled for the service manual with no result other than someone in the states selling on ebay for around $22. I wish companies like this would get their service manuals PDF’d and onto the web – shouldn’t be an issue for what is essentially obsolete equipment?
Anyway, with no solution available from the outside, I decided to take a quick look inside to see if there was anything obviously out of place. Getting inside is easy:
- Remove the 5 screws from the back panel
- Carefully part the two sides noting that:
- The power on/off slider will likely drop out as it detaches from the internal control
- all the other sliders remain with the top of the case – but some detach in the process from the underlying control which remains in the base.
- In my case the forward position of the tape heads was preventing the sides from separating. Pressing them back by pressing the plastic between the erase and write heads made enough space.
With the sides parted, I then powered up and observed the mechanics when pressing the various control buttons. I couldn’t see anything obvious, but then noticed that underneath the controls is a flywheel attached to that capstan in-front of the stop button. The flywheel is belt-driven and was not spinning.
Using a cotton bud, I gave it a few nudges, attempting to pushing it round in either direction. I was quite surprised after a few attempts when the belt picked up and the flywheel turned under the power of the motor. At the same time the heads snapped back into the retracted position, and the play and record buttons now worked.
All that remained was to give it a good clean-out and reassemble. Taking care to align the Record function sliders with their underlying controls, and get the 5 screws back in, and I am back in action with kit that I thought was pretty cutting edge back in 1987.
About to suffer a little more pain than usual in renewing my Microsoft Action Pack subscription (note: don’t expect that link to display correctly in anything other than Microsoft Explorer). This year things have changed. Instead of everyone receiving physical media, we now have the option to download. Good for the environment.
Download users will pay the same pre-tax price as last year (£199) and physical media users will pay more (£273). But then there is VAT. We have different rates across the EU. In the UK the rate is currently 15%.
- If you order physical media, you will pay the VAT for your region. In the UK, 15%.
- If you order a download, you will pay the VAT for Ireland. 21.5%.
This really bugs me (accelerating me to grumpy-old-man status) and I have moaned about it before in relation to Adobe products. There must be some incentive or other good reasons for these companies to locate their online distribution services in Ireland. But they need to realise that they are costing many of their customers more by doing so.
I’m not sure if I should be moaning about the companies choice of country, or VAT and EU regulation in general. Greater minds than mine have argued against the VAT complexity in the past and failed to make any progress. So maybe time to give up, just get the extra 6.5% paid and go hit a punch-bag.
Quickly creating re-usable components based on others, augmented with additional ActionScript behaviour using MXML is as simple as can be. However, to create a component from scratch using ActionScript requires a lot of detailed knowledge of how the Flex framework works and the component life-cycle in particular.
The Flex documentation attempts to describe the lifecycle, but can leave the developer with lots of unanswered questions. When I got more involved in developing components I found chapter 19 of Programming Flex 3 good for filling in the gaps.
This week a new and free paper has been published by DevelopmentArc that also explores the component life-cycle and the application life-cycle. A very well worth while read….
Feel free to post links to other compent lifecycle resrouces in the comments.
Just a quick note to highlight that Adobe today released Fireworks CS4 10.0.3 updater. Amongst other things this update fixes the text alignment problem which has been affecting so many users.
Some relevant links: