Jump to content
Search Community

isaacalves

Members
  • Posts

    30
  • Joined

  • Last visited

Everything posted by isaacalves

  1. Hey Carl, I'll check out other forums. Thanks a lot for your attention and suggestions!! Cheers
  2. Hey Carl, what's up? That's not really a problem... for example... in that case, when I have a 'component SWF' (StatusPanel) that gets loaded in two or more 'pages SWFs', I can do something like this: I declared the 'component SWF' as a class variable of the class of the 'page SWF' that'll load it. If I use strong typing I get plenty of errors. private var statusPanel:*; and then when it gest loaded, in the SWFLoader onComplete handler: statusPanel = e.target.content.getChildAt(0); and when i want to dispose it i'll do: if (statusPanel) statusPanel.dispose(); That doesn't seem to be a good practice... I'm actullay asking for suggestions on how to build/structure a website/app with a modular approach. What I do now is basically use the Flash IDE to build the library of MovieClips, embedded small bitmaps, fonts, etc, and pre arrange this stuff on the stage. And then I use TextMate for coding, trying to keep as modular as possible in order to have consistency and reuse code. What happens is that i eventually face some situations where I have to decide whether I'll make something a different SWF, a MovieClip in the library that'll be linked to a Class and I'll instantiate in AS3, or leave it already added to the stage in the FLA... No big deal, I just would like to know other people's thoughts on that. As well as on handling 'pages SWFs' with Greensock's SWFLoader. I've used some frameworks like Gaia, a couple of times already, but I'm trying to do things on my own now...I graduated in design but in terms of code i'm an autodidact, so stuff like MVC frightens me up yet... Cheers!
  3. I'm building a website - using Flash IDE and Textmate - from scratch using just a couple frameworks (Greensock for tweening and loading), and a singleton class to handle the whole thing. I'm not using any framework like Gaia, for instance, or any other MVC framework. The singleton helps me keep track of the pages and components, in a way I can add objects to it, and then have access to them whenever I am. I mean, For example, on the constructor of each swf's class I have something like this: _app = myApp.getInstance(); _app.addObject("contactpage", this); Some pages are quite complex, with panels, menus and galleries, etc, so I've linked some movieclips that are already on stage to separated classes, to provide an easier maintenance of the code. Then i have some movieclips on the library with linkage IDs for instatiating on ActionScript. Finally I have also some components that are separated SWFs, cause they must be on different pages. For example, I have a StatusPanel that appears both on the OrderPage and the GalleryPage. I have dispose() methods in each classes, in order to avoid errors and CPU consuming. Though it's organized in my own way, I sometimes face problems for example, when I want to access the dispose methods of loaded SWFs that are loaded with SWFLoader for example. Well I can circumvent that but the whole thing becomes messy each time.. What do you guys think? Which are the best practices on that issue? Thanks!
  4. that's just perfect! thanks a lot!! by the way, i saw a tutorial by you two days ago, which inspired me to make my own 'OOP slideshow' presentation...
  5. Thanks a lot! Tweening the 'frame' attribute works really nice. I'm using the code below to make the globe spin. TweenMax.to(globe, speed, {frame: 360, repeat: -1, ease:Linear.easeNone}); Now let's say the globe is currently on frame 19. Can I make it Tween to the frame 18 without moving back on the timeline? That means tweening to 360 then restart at 0 until 18 and the loop that? Is it possible to do something like that? What I'm trying to do is to control the globe with a slider, that sets a speed (that is used to calculate the duration of the tween) and then tell the Globe to tween to the previous frame, depending on the currentFrame, in a loop (repeat: -1). But it needs to move forward, always. I've tried associating the slider with the duration of the tween but it doesn't work as I expected... any ideas? Thanks!
  6. Can I change the frame rate of AS2 dinamically? In order to smoothly accelerate or deaccelerate an animation like this: http://activeden.net/item/spinning-3d-e ... of-5/81611 Maybe the best solution is convert it to AS3? Is is possible to use the TimelineLite/Max methods on a timeline-based animation like this globe? Or attach this globe in a TimelineLite/Max instance? I guess there's no much code on this animation, and that actually all I need are those frames... Or maybe use some 'fisheye' effect with displacement filter on a flat map image? Since this project I'm working on is not for web, there won't be any problem on loading 360 frames for an animation, though... What do you people recommend? Thanks!
  7. Thanks for clarifying me that. Cheers!
  8. Hi, I solved my problem using the offset parameter of the append method, as in this case nearly all tweens are appended in a for loop. So I'd still like to know why it didn't work the other way cause normally I'd like to use the 'stagger' properties of the timeline constructor. tl.append(new TweenLite(mc.getChildAt(j), 1, {alpha: 1}), -.9); Thanks
  9. I want the tweens to be delayed from each other by 0.1 second. var tl:TimelineLite = new TimelineLite({align: TweenAlign.NORMAL, stagger: 0.1}); var j:int; for (var i:int; i < map.numChildren; i++) { var mc:MovieClip = map.getChildAt(i); j = 0; for (j; j < mc.numChildren; j++) { tl.insert(TweenLite.from(mc.getChildAt(j), 1, {alpha: 0})); counter ++; } } I tried using TweenAlign.SEQUENCE and stagger = -0.9 - I should get the same result right? But they all start at the same time.. and if I use "append" they go on sequence - no stagger... what am I missing here? Thanks in advance
  10. myVideoLoader.duration doesn't return the correct value. It should return 50 but it returns 200. That happens only with a specific .flv file that I am loading with VideoLoader. And in the last version of this video (the same video, just compressed differently) it didn't have that problem. Why does that happens? Thanks in advance
  11. Hey Jack, there's something weird going on when it loads and displays the image. I am not able to click on areas adjacent to the image, it seems that there's a transparent rectangle of the original size of the image ( cause i've set width, height, and propInside in the ImageLoader ). I called an eventListener from the imageHolder and it traces like i was clicking on a bitmap, and if i trace the width of the container of the image loaded, it traces the original width. Why does that happen?
  12. Yeah I was doing something really dumb, maybe too much motivated with programming. Still a long path though. So, I just eliminated 150 lines of code. Thanks a lot !
  13. You mean I don't need a different maximum width and height value for 'portrait' and 'landscape'? I guess I'm complicating things in vain... one MAX_WIDTH and one MAX_HEIGHT are enough.. thanks!
  14. Hello, I'm building an Image Gallery, and I've come up with this ugly code which I'm trying to clean up. What it actually does is check whether the image loaded is PORTRAIT or LANDSCAPE by comparing the width and height of the ImageLoader.content. Then it will swap some values (_maxWidth and _maxHeight), so it can later scale the image to _maxWidth and _maxHeight. Then the user will be able to zoom the image, using a "panning" class that will scroll the image inside the holder. So here is my code so far, it's not so cool: private function scalePropInside():void { // this will scale proportional inside. if (_imageOrientation == "landscape"){ // must ajust width first if (_imageWidth > _maxWidth) { _imageWidth = _maxWidth; _imageHeight = _maxHeight * _imageWidth/_imageHeight; } if (_imageHeight > _maxHeight) { _imageHeight = _maxHeight; _imageWidth = _imageHeight * _maxWidth/_maxHeight; } }else{ // must ajust height first if (_imageHeight > _maxHeight) { _imageHeight = _maxHeight; _imageWidth = _imageHeight * _maxWidth/_maxHeight; } if (_imageWidth > _maxWidth) { _imageWidth = _maxWidth; _imageHeight = _maxHeight * _imageWidth/_imageHeight; } } } private function onImageLoaded(e:Event):void { while (imageContainer.holder.numChildren > 1) imageContainer.holder.removeChildAt(0); // GET DIMENSIONS FROM IMAGELOADER _imageWidth = e.target.content.width; _imageHeight = e.target.content.height; // SET IMAGE ORIENTATION //_imageHeight > _imageWidth ? setImageOrientation("portrait") : setImageOrientation("landscape"); if (_imageHeight > _imageWidth){ _imageOrientation = "portrait"; _maxWidth = PORTRAIT_WIDTH; _maxHeight = PORTRAIT_HEIGHT; }else{ _imageOrientation = "landscape"; _maxWidth = LANDSCAPE_WIDTH; _maxHeight = LANDSCAPE_HEIGHT; } // SCALE IMAGE scalePropInside(); // REPOSITION ALL ELEMENTS imageContainer.holder.width = _imageWidth; imageContainer.holder.height = _imageHeight; imageContainer.holder.x = -_imageWidth * .5; imageContainer.holder.y = -_imageHeight * .5; imageContainer.holderMask.width = _imageWidth; imageContainer.holderMask.height = 0; imageContainer.holderMask.x = -_imageWidth * .5; //imageContainer.holderMask.y = -_imageHeight * .5; imageContainer.prevBtn.x = -_imageWidth * .5; imageContainer.nextBtn.x = _imageWidth * .5; TweenMax.to(imageContainer.holderMask, .6, {height: _imageHeight, ease:Expo.easeOut}); TweenMax.to(imageContainer.prevBtn, .3, {autoAlpha: 1, x: "-30", delay: 0.1, ease:Expo.easeOut}); TweenMax.to(imageContainer.nextBtn, .3, {autoAlpha: 1, x: "30", delay: 0.2, ease:Expo.easeOut}); } As you can see, the code of the function scalePropInside() looks ridiculous. I know I can pass the argument scaleMode: propInside, but then I'd need to know if it was portrait or landscape prior to loading the image, for example setting in the xml. What are the best practices on that issue? thanks in advance!
  15. Yeah, you're right ...it makes sense I wanted to insert the tweens and put a delay on each one and multiply the delay by "i" ,but I would like to reverse that order . So the cube created in the first iteration would get the biggest delay. So I solved that by switching a plus and a minus operator on this line (I inverted the order of the target X for each cube) : _cubeVarsObj = {x: -(_xOffset + _cubeW)*i + (_xOffset + _cubeW)*(_totalCubes*.5), y: 0}; thanks for clearing that out for me. cheers!
  16. Hello, I would like to append (prepend actually) tweens in a timeline one by one, in a for loop (instead of using the appendMultiple). But when I do it this way, using append() or prepend(), the tweens don't get aligned as it was supposed to ("normal"), they are aligned like in sequence. If I use insert() they align correctly... in cases like these I've been using insert() instead of append(), but now I would like to prepend(), so, how do I do? Why doesn't it align correctly? timeline = new TimelineLite({delay: 1, paused: true, align: "normal"}); for (var i:int; i < _totalCubes; i++){ var _cube:Cube = new Cube(materialsList, _cubeW, _cubeD, _cubeH); _cube.x = -2000; _cube.rotationY = 15; _cubeVarsObj = {x: (_xOffset + _cubeW)*i - (_xOffset + _cubeW)*(_totalCubes*.5), y: 0} scene.addChild(_cube); timeline.prepend(TweenLite.to(_cube, 1, {x: _cubeVarsObj.x, delay: 0.1*i, ease:Quart.easeOut})); } timeline.play(); Well I know there are thousand of ways to do what i need there, but I would like to understand why the TimelineLite behaves like that.. Thanks in advance!
  17. Thanks Jack ! The first solution you gave is quite interesting, i'll eventually try that. I actually forgot to mark to get an e-mail notification, so I've already solved the problem...but your replies are always helpful anyways. Well I did more or less what you wrote on the second option ... and in the place of the each video I put an image of the first frame of that video. Cheers!
  18. Hello, I'm working on a website where the home page has 7 videos, which are not supposed to be interactive (one cannot pause them for example), they're just part of the layout and have no sound, only video. they are small (in dimension and length) videos that loop forever. all videos sum 376kb, which is not nice, cause the user has to wait all videos to load to enter the website. Since the videos are part of the layout , it wouldn't work to stream the videos .... but maybe that could be a solution if i could make the swf load a portion of each video, a portion that would be enough to play them without making them pause cause they were loading.... well i hope i'm being clear... So... is that possible to do? are there any other solution? what is the "recommendation" in a situation like that ? Thanks in advance!
  19. Hello, I'm creating a swf file that will be displayed on an elevator screen. It'll be a FLV but they also want a swf. Some of the specifications include : must be AS 2.0, cannot use _root, global variables, #include, fscommand, among others. I used greensock's Tweenlite to do some tweens and they said I cannot use any external packages! I would like to understand what's the problem. I asked them (haven't got an answer yet) but I'd like to get different feedback on this topic. And if anyone can help me with doing the same as I do with this little piece of code below without using a tween engine neither the timeline, I would really appreciate: var len:Number = squares.length; for (var i = 0; i < len; i++){ TweenLite.from(squares[i], 0.3, {_xscale: 0, delay: i*0.03, ease: Expo.easeOut}); } What I do here is animate a bunch of squares (that form a mask) There's a lot of squares, I don't want to do that kind of work in the timeline for obvious reasons and I'm also using other code to randomize the array and other stuff. Thanks in advance!
  20. I would like to have have an xml where i can write properties for tweens, and then in Actionscript i would send those properties as parameters to a method, where the tweens would be created. How could I send then the ease property? Should it be a string, an integer? Thanks!
  21. I can think of a lot of ways of doing that.. One method is to use a slideshow class (or create yours) which uses a Timer to load and switch images, and greensock's tween could handle the transitions, for example. It could be used also to handle the smooth movement of the image, as in the example you mentioned. You could also try something with greensock's TweenMax properties delay, repeat, onComplete...
  22. Then I guess you'd have to tween the 'width' property. Does it need to be 'scaleX', in your situation?
×
×
  • Create New...