Monday, October 06, 2008

mx:Image limitation

I have a website I'm working on where the background is 8000 pixels wide and 800 pixels tall. I tried for hours, but I could not get the image to load. So how did I solve the problem? With a rather ugly workaround. I created a HBOX with a horizontalGap of 0 and then put two images in it each one being 4000x800. That worked perfectly. I don't have time to really dig in and figure out what's going on or what specifically the limitation is, but I do know that it has something to do with dimensions, and not file size. The reason I know this is because in my efforts to fix it, I tried making the image a really compressed lossy JPEG and even that wouldn't load (it was only 200k!). The version that's up now is about 1,200k (two 600k images) and it's running fine. I'll let you all know when it's up because this site should be pretty visually awesome... although the content is a bit questionable.

Labels: , , , ,

Monday, July 07, 2008

PureMVC: SendNotification vs. NotifyObservers

PureMVC has two ways to dispatch a Notification. A "note" for short, is like a Flex Event but that's another story. So what's the difference? The main difference is that sendNotifiaction builds the note and sends it at the same time. It's arguments are the same as Notification. notifyObservers is perfect for when you already have a notification constructed or you have a custom implementation of notification. notifyObservers(new Notification("SomeNotificationName"));

VS

sendNotification("SomeNotificationName") NotifyObservers can be called from the facade and other than the constructor argument, pretty much works the same way. sendNotification can be called from a proxy or mediator.I may have this wrong, but I don't think you can do sendNotification from a command, and I'm not sure exactly why. So if you need to dispatch an event from Command, I guess that's another use for facade.notifyObservers. You can send notifications from command, mediator, or proxy.

Labels: , , , , ,

Friday, June 27, 2008

PureMVC Argument

So me and the other people in my team got in a small argument over the proper use of PureMVC's mediators. We've read in various blogs that it is not a good practice to call a Proxy directly from a mediator. If you're going to call a proxy, it needs to be done from a command. In this particular case, we're asking for the proxy to refresh some data. That's it... one call. someProxy.refresh(). The refresh will send it's notification and our mediator will update. So one of my coworkers wanted to register a command that called someProxy.refresh() and then send a notification from the mediator. If there was some business logic that needed to happen, I'd be all for it! But there isn't, we're just refreshing an array collection. So someone please tell me why should I register a command to call a proxy in this case? And to further my point, the employee admin demo on PureMVC's official website does exactly what I'm describing in RolePanelMediator.as private function onAddRole( event:Event ):void { roleProxy.addRoleToUser( rolePanel.user, rolePanel.selectedRole ); } private function onRemoveRole( event:Event ):void { roleProxy.removeRoleFromUser( rolePanel.user, rolePanel.selectedRole ); } I am not a very stubborn person. if someone can make a good point for why I shouldn't do it this way, then I'll change my ways. I promise.

Labels: , , , , , ,

Feed (RSS/Atom)

Contact Me

Don't put anything here: