Use multiple components in Flash AS3 - iPhone app - iphone

First of all: Happy new year!
I have a problem with Flash CS5.5, AS3. I have two ScrollPane Components in my document. They are both in another scene and the (instant)names are unique. But it isn’t working properly. When I go to the other scene with the second ScrollPane I get an error & it starts to flicker.
My error:
TypeError: Error #1006: setSize is not a function. at
application051_fla::MainTimeline/frame25()[application051_fla.MainTimeline::frame25:7]
I want to make an iPhone application and I want that multiple components working properly in one document.
My little piece of code (don’t think that the problem is in here):
ScrollPane02.source = tekst03;
ScrollPane02.setSize(350,400);
ScrollPane02.move(0, 20);
ScrollPane02.scrollDrag = false;
If you know the answer or what I am doing wrong, please comment! Searching for hours/days!
Thanks in advance!
Uploaded the .fla document. If you want to take a look at it (please), you can download it here: http://www.bregjebouwmans.nl/application061.fla

Edit:
Ok, after digging through the FLA, I finally figured out what you did . . . you right clicked on ScrollPane in the "Library", and clicked "Duplicate". Then you gave it the name ScrollPane02. Except that the duplication process did not connect the new object to the ScrollPane's setup. Instead, it created a generic MovieClip object. Since it is not an actual ScrollPane, it makes sense that all the methods on the timeline's Actionscript will fail.
This is why the solution (in the comments below) works. #AsTheWormTurns just used the first (actual) ScrollPane in two instances on the timeline; is a viable solution.
(The only caveat being that if you change the ScrollPane object in the Library, it will affect all instances. That shouldn't really be a problem, since -- for components -- you generally make changes only to instances.)
Useful tips from my initial answer:
When compiled into an SWF, scenes are just stuck one right after the other in the timeline, just like scenes in a movie. If you do not have a stop() at the end of one scene, it will continue to run right into the next scene, just like a movie. The idea of scenes is to separate content. This means that what exists in sceneA does not exist in sceneB. The scenes also have no access to each other.
My advice is to not use scenes at all. They are difficult to use correctly, and have very little use that is not better done using the timeline or Actionscript.

Related

Unity Glitching when I run the Game

I made a Model of the solar system and when I run the program this happens:
I am not sure what is causing this so if you have any idea Pls Reply.
The Scene load is being triggered multiple times:
Check if you have any code that you're using to load the scene (In Update, perhaps?) if youre using it in update, check if you're using GetKey instead of GetKeyDown (GetKey will remain true as long as you keep it pressed)
The information provided here is too little and we can only speculate at this point. please post code, more images and a better description of the problem. How did you reproduce this issue?

Identifying unity gameObjects (pre-runtime) to save/load their data

I pretty much already made a little quest game for Android, and it only just occurred to me that I have to save player's progress.
I have a lot of interactive game objects (they share a script InteractiveObject that I made), which has an integer "CurrentPosition" parameter, that tracks how the player interacted with it. I need to save that parameter for all of those game objects.
What I figured I will do is pass this data to some "manager" singleton class after every interaction, and compile it into the list.. only I have nothing to identify those game objects by. GetInstanceID is unique, but not persistent, so its useless for this purpose.
Of course, I could just add "ID" parameter ty my script, and fill it by-hand in editor.. but that seems to be a suboptimal solution. There are a lot of those objects.
Any suggestions?
You need to somehow "register" your buttons
This is basically the same idea as "give them all an ID manually" except replace manually with "using code."
The first problem you have is that all of your buttons are hand-placed in your scene and all of their interactions are done by hand and all of this was done manually with no regard to "I'm going to need to be able to identify these later" which is how you've ended up here.
Option 1:
Have your code create, place, and name your buttons. As your code is yours it will just automatically generate the required ID and retrieve the state from the save file because you built it to handle this requirement from the get-go.
As you haven't already set your project up this way, this will be a lot of work spent refactoring your project to do it this way.
Option 2:
Do it manually as you stated you don't want to do. You may have to decide that this is the least work-intensive solution that is also reliable.
Option 3:
Create a class that all it does is have a registerButton function that shoves the buttons into an array so that they have an index ID value. When your buttons run their Start() method (if they do not have a Monobehavior script yet, give them one for this purpose) calls this registerButton method, which returns an ID (its literally just the button's index in the all_the_buttons array). Use this as your serialization ID.
Note that while this is deterministic (in that the buttons will register themselves in the same order every time) it occurs in an unknown order. If you delete, clone, create, or move the button around in the scene hierarchy, you will affect what IDs your buttons have, possibly invalidating any existing save files.
you can use playerprefs to save the game data , take a look at this link https://docs.unity3d.com/ScriptReference/PlayerPrefs.html

Unity Interface select on Click in Scene View

Unity won't let me select objects on my scene without first selecting the object in the Hierarchy. This was all I could find on the issue.
However, it seems that they decided that closing and opening the scene window fixed the bug, but not so with me. Also note that I am on a blank project. Its been really difficult to work around this bug.
Edit:
I have even uninstalled Unity and reinstalled with the hopes that this would solve the problem, but unfortunately it did not. Thanks for any help ahead of time.
Honestly this is such an odd problem that I'm having difficulty knowing how to try and fix the problem. I also reported the bug as recommended below by NoëlWidmer, but even the staff who was very kind had no idea how to deal with the problem, and the advice he gave also didn't change a thing. Truly, I don't even know what more information I can give you guys because as I said I literally opened a new Unity project for the first time after reinstalling and was unable to select without first clicking on the hierarchy. Is this just a special freak case that landed with me or has this happened to anyone else?? Also I'm using a two year old Windows 8 Laptop with literally nothing installed on it but the Adobe suite and a few other game developer necessities, so my computer most likely is not the source of the problem.
Edit: a Clue??
Well I was messing around with the scene and hierarchy view in full screen, and I noticed something interesting after clicking on the object in the hierarchy and moving the object in the scene view:
Unfortunately my PrintScreen doesnt show the actual mouse, but as you can see the scene view acts as though I'm clicking on the object, but here at the same time I saw my real mouse off down to the right! Also while I've selected an object on the scene editor and I move my mouse off the scene window things get a bit off and the mouse will pop up on other sides of the window and so on. I don't know if that's normal and its that way for everyone or if it's just me and it might help figure out what's going on.
Man I've really been liking Unity but if this keeps up I think I'll have to drop it and find another software, because I certainly will never be able to design anything worth while if I have to select the object on the hierarchy every time for every single object.
Some bug for me on Mac platform. I resolve just entering and exit from fullscreen mode.
Probably may also work change layout with top-right combo.
I had similar issue while using older versions of unity (in addition inspector window lost the focus repeatedly). In my case rearraging editor windows and saving custom window layout solved it. As far as I remember, I just moved scene view outside Unity window (on the second screen) as well as hierarchy view, and saved resulting position as a new window layout.
Not sure if there is anything else I can tell about it, it's pretty mysterious problem.
I'm overwhelmed with joy right now!! The problem was indeed a bug. I was working on a project and moving objects around (still using the hierarchy to select objects) and then a split second later for absolutely no reason Unity decided to start working the way it should've!!! I guess its just one of those issues where you just have to cross your fingers and hope it'll resolve itself. I'm so glad this dumb issue resolved itself because I was about to tear my hair out and succumb to using another computer for my unity design, or even worse another software. Thank you to everyone who helped!

In-app tutorial

Im looking at adding a tutorial kind of thing to my app. Basically I want to be able to give a quick message across of what the parts in the app do. I want the users to see it once and not again. I have searched relentlessly for this but I always found app building tutorials.
A lot of games have what I want but I cannot for the life of me find how to do it or, what it is called to find a tutorial. Could someone please help me out.
Thanks in advance,
Sam
You'll need to build it yourself.
What I usually do is, on top of the view i want to explain, add a semi transparent view with some arrows pointing at stuff and a small text/button explaining it. All of that has to be modal and you can save in the NSUserDefaults if the user has already seen it/skipped it/launched the app for the first time. You'd have a method that builds all those views and you simply call it in viewDidLoad (by checking against a simple boolean value store in those previously mentioned NSUserDefaults, for example)

How to create tabs dynamically in Objective C

I am trying to implement the following kind of tabs into my Application. I have first tried it with creating buttons. So can anyone guide me how to create this kind of interface ?
I want to clarify that this are the groups & it will be dynamically created & it can be in any number.
Any suggestions & references will be highly appreciated.
Thanks in advance.
I've been implementing pretty much exactly what you are asking in an app im working on, i've uploaded the source files here. its pretty much plug-and-play, just make a TabView where you want your tabs and hook up the delegate methods. can swap out all the images with your own (my tabs were underneath something and not on top so they will look upside down initially for you).
Dont really have time to explain the inner workings of it all, but if you play around with the code im sure you will manage to customise it how you want. otherwise, just learn from it and implement your own.
edit: oh and there is some code that changes how the tabs look depending if iOS 7 or not, you will get an error when first importing it because i have a variable in my appDelegate isIOS7 which you can either implement in your app, or just take out all the relevant iOS 7 checks in the code